(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Biodiversity Heritage Library | Children's Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "TI Extended Basic"

Texas Instruments 
TI-99/4 Home Computer 




Extended 

iash 



FOR THE TI-99/4 HOME COMPUTER 



A powerful, high-level programming language that 
expands the capability of your Ti-99/4 Home Computer. 
Includes these features: 

Mora than 40 n* Mr or expanded commands, 

statements, functions, and subprograms. 
Multiple-statement lines for speed and efficiency. 
Sprite (moving graphics) capability. 

Subprogram capability that tat* you stutv win m only 

used subprograms on diskette for use as needed. 
The ability to toad and run one program from another. 
Comprehensive program control of errors, warnings, 

and breakpoints. 

Direct screen control oi Input and output 
Support for loading and running TMS9900 Assembly 
Language programs it the optional Memory EMpansion 
unit (sold separately) Is attached to the computer 

CONTENTS: Tt Extended BASIC module 

(36K bytes of preprogrammed memory) 
Owner's reference manual 



IMPORTANT NOTICE REGARDING 
PROGRAMS AND BOOK MATERIALS 




The following should be read and understood before purchasing and/or using 
TI Extended BASIC. 

Texas Instruments does not warrant that the programs contained in the TI 
Extended BASIC module and accompanying book materials will mset the 
specific requirements of the consumer, or that the programs and book 
materials will be free from error. The consumer assumes complete 
responsibility for any decision made or actions taken based on information 
obtained using these programs and book materials. Any statements made 
concerning the utility of TI's programs and book materials are not to be 
construed as express or implied warranties. 

TEXAS INSTRUMENTS HAKES NO WARRANTY, EITHER EXPRESSED OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO ANT IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, 
REGARDING THESE PROGRAMS OR BOOK MATERIALS OR ANT PROGRAMS 
DERIVED THEREFROM AND MAKES SUCH MATERIALS AVAILABLE SOLELY 
ON AN "AS IS" BASIS. 

IN NO EVENT SHALL TEXAS INSTRUMENTS BE LIABLE TO ANYONE FOR 
SPECIAL, COLLATERAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN 
CONNECTION WITH OR ARISING OUT OF THE PURCHASE OR USE OF THESE 
PROGRAMS OR BOOK MATERIALS, AND THE SOIE AND EXCLUSIVE 
LIABILITY OF TEXAS INSTRUMENTS, REGARDLESS OF THE FORM OF 
ACTION, SHALL NOT EXCEED THE PURCHASE PRICE OF THIS MODULE, 
MOREOVER, TEXAS INSTRUMENTS SHALL NOT BE LIABLE FOR AUY CLAIM 
OF ANY KIND WHATSOEVER AGAINST THE USER OF THESE PROGRAMS OR 
BOOK MATERIALS BY ANY OTHER PARTY. 

Soms states do not allow the exclusion or limitatisn of implied warranties or 
consequential damages, so the above limitations or exclusions may not apply 
to ycu. 



77 Extended BASIC 



FOR THE TI-99/4 HOME COMPUTER 

A powerful, high-level programming language that 
expands the capability of your TI-99/4 Home 
Computer. Includes these features: 
m More than 40 new or expanded commands, 
statements, functions, and subprograms, 

m Multiple-siatement tines for speed and 

efficiency. 
m Sprite (moving graphics) capability. 

m Subprogram capability that lets you store 
commonly used subprograms on diskette for 
use as needed. 

m The ability to load and run one program from 
another. 

m Comprehensive program control of errors, 

warnings, and breakpoints. 
■ Direct screen control of input and output. 

m Support for loading and running TMS9900 
Assembly Language programs if the optional 
Memory Expansion unit (sold separately) Is 
attached to the computer. 



Copyight :i -.: 1981 Texas instruments Incorporated 

Program and database contents 

copyrgnt il 1961 Texas Instruments incorporated. 

See moonant waranty information at backo' cook. 



Table of Contents 



This book was developed and written by: 

Robert E. Whitsitt, II ^ t 

and other staff members of the Texas Instruments Learning Center 
and the Texas Instruments Personal Computer Division. 

With contributions by: 
Tom M. Ferrio 
Stanley R Hume 
<jacquelyn F. Quiram 

Artwork and layout were coordinated and executed by: 

Schenck Design Associates. Inc. 



Page 

Chapter 1 —INTRODUCTION 7 

Features 8 

Changes from TI BASIC 10 

How to Use this Manual 10 

How to Use the Computer 11 

Operating in TI Extended BASIC 11 

Special Key Functions 12 

Chapter 2 — OVERVIEW OF TI EXTENDED BASIC 15 

Commands 15 

Assignments and Input 17 

Output 13 

Functions, Subroutines, and Subprograms 19 

Built-in Functions 20 

User-Defined Functions 21 

Subroutines 21 

Built-in Subprograms 21 

User-Written Subprograms 23 

Sound, Speech, and Color 24 

Sprites 25 

Debugging 23 

Error Handling 25 

Program Entry Example 27 

Chapter 3— TI EXTENDED BASIC CONVENTIONS 37 

Running a Program on Powcrup 38 

Files 33 

Line Numbers 38 

Lines 33 

Special Symbols 38 

Spaces 39 

Numeric Constants 39 

String Constants 39 

Variables 39 

Numeric Expressions 41 

String Expressions 41 

Relational Expressions 41 

Logical Expressions 42 



ISBN "0-89512-045-3 

Library of Congress dialog *B0-54H99 



Copyright ;:.'■ 1981 by Texas Instiumrnis Incrporated 



n Extended BASK 



11 Extended BASIC 



TABLE OF CONTENTS 



TABLE OF CONTENTS 



Chapter 4 — REFERENCE SECTION 45 

ABS 46 

ACCEPT 47 

ASC 50 

ATN 51 

BREAK 52 

BYE 54 

CALL 55 

CHAR 56 

CHARPAT 59 

CHARSET 60 

CHRS 60 

CLEAR 61 

CLOSE 62 

COINC 64 

COLOR 66 

CONTINUE 68 

COS 69 

DATA 70 

DEF 72 

DELETE 74 

DELSPRITE 75 

DIM 76 

DISPLAY 77 

DISPLAY,,. USING 79 

DISTANCE 80 

END 81 

EOF S2 

ERR 83 

EXP 85 

FOR-TO-STEP 86 

GCHAR 88 

GOSUB 89 

GOTO 91 

HCHAR 92 

IF-THEN-ELSE 94 

IMAGE 97 

INIT 101 

INPUT 102 

INPUT (with files) 104 

INT 107 

JOYST 108 

KEY L09 

LEN no 



TI Extended BASIC 



let , n 

LINK H2 

LINPUT U3 

LIST U4 

LOAD H5 

LOCATE 1 1 6 

LOG ! i 7 

MAGNIFY J 18 

MAX i 21 

MERGE 12 2 

MIN .'^.'l24 

MOTION 125 

NEW I23 

NEXT J27 

NUMBER ]28 

OLD [ 12g 

ON BREAK , 30 

ONERROR 13[ 

ON GOSUB .„„ 

ONGOTO ** 

ON WARNING \Z1 

open {r: 

OPTION BASE . , . , d 

PATTERN ^ 

£f EK ::::::::::::::::::::. ::::!« 

pos'::;:;;:;;:;;:; \tt 

POSITION ™ 

PRINT/ J*° 

PRINT USING .... tzl 

RANDOMIZE ... !?T 

READ L ^ 1 

REM " 153 

RESEQUENCE .[[ }^ 

RESTORE. ... I55 

RETURN (with GOSUB) !^ 

RETURN (with ON ERROR) \zL 

rnd 158 

RPT$ 159 

RU\ 160 

SAVE 161 

SAY 163 

SCREEN 164 

165 

11 Extended »ASIC 



TABLE OF CONTENTS 



CHAPTER 



SEGS 
SGN . 

SIN . . 
SIZE . 



166 

167 

168 

,[[[[ ' ' * 169 

SOUND 170 

SPGET 172 

SPRITE 173 

SQR 178 

STOP 178 

STR$ 179 

SUB 180 

SUBEND 184 

SUBEXIT 184 

TAB 185 

TAN 186 

TRACE 186 

UNBREAK 187 

UNTRACE 187 

VAL 188 

VCHAR 188 

VERSION 190 

APPENDICES 

Appendix A — List ol'Illustrative Programs 192 

Appendix; B — List of Commands, Statements, and Functions 194 

Appendix C — ASCII Codes 196 

Appendix D — Musical Tone Frequencies 197 

Appendix E — Character Sets 198 

Appendix F — Paitern-ldentifier Conversion Table 198 

Appendix G — Co.or Codes 199 

Appendix H — Co.or Combinations 200 

Appendix I — Spit Console Keyboard 201 

Appendix J — Character Codes for Split Keyboard 201 

Appendix K — Mathematical Functions 202 

Appendix L — List of Speech Words 203 

Appendix M — Adding Suffixes to Speech Words 206 

Appendix N — Error Messages 212 



1 



Introduction 



Tl Extended BASIC 



TI Extend Ml BASK: 



CHAPTER 



INTRODUCTION 



1 



FEATURES 

Texas Instruments ExLended BASIC is a powerful computer programming 
language Tor use with the Texas Instruments TI-99/4 Home Computer. It has 
the features expected from a high level language plus additional features not 
available in many other languages, including those designed for use with 
large, expensive computers. 

TI Extended BASIC goes beyond Texas Instruments BASIC to enhance the 
capability and flexibility of your computer system by adding these features: 

■ Input and Output — The ACCEPT statement allows the input of data from 
anywhere on the screen. You may clear the screen, accept only certain 
characters, and limit the number of charae ers entered using this 
statement. The DISPLAY statement has been enhanced to allow putting 
data anywhere en the screen, and DISPLAY ... USING, PRINT ... USING, 
and IMAGE have been added for ease in formatting data on die display 
screen and peripheral devices. 

■ Subprograms —Subprograms with local variables (affecting only values 
within the subprogram) can be written in Tl Extended BASIC. Commonly 
used subprograms may be stored on a diskette and added to programs as 
needed. Statements included are SUB, SUBEND. and SUBEXIT. The 
MERGE command has ban added and the SAVE command modified to 
allow the merging of programs from diskettes. 

■ Sprites — Sprites are specially defined graphics with the ability to move 
smoothly on the screen. To provide the sprite capability, the following 
subprograms ha^e been included in TI Extended BASIC: COIMC, 
DELSPRITE. DISTANCE, LOCATE, MAGNIFY. MOTION. PATTERN. 
POSITION, and SPRITE. COLOR and CHAH have been redesigned so they 
also can affect sprites. 

■ Functions — M^X, returning the larger of two numbers; MIN returning 
the smaller of two numbers; and PI, returning the value of vr , have been 
included in TI Extended BASIC. 

■ Arrays — Arrays may have up to seven dimensions instead or three. 

■ String Handling — The KPTS function allocs the repetition of a string. 

■ Krror Handling — With TI Extended BASIC, you can choose what action 
is taken if there :s a minor error (which in TI BASIC causes a warning 
message), a major error (which in TI BASIC causes an error message and 
stops the program), or a breakpoint (which in Tl BASIC causes the 
program to halt) The new statements allowing this control are ON 
WARNING. ON ERROR, and ON BREAK. RETURN has been modified for 
use with error handling. The CALL ERR statement can be used to 
determine the nature of an error that occurs in a program. 

8 TlKx tended BASIC 



B RUN as a Statement — RUN can be used as a statement as well as a 
command. RUN has also been modified to allov you to specify which 
program to run. Asa result, one prog-am can load and run another 
program from a diskette. You can. therefore, write programs of almost 
unlimited size by breaking them into pieces arid letting each segment rur 
the next. 

■ Power-up Program Execution — When TI Extended BASIC is first chosen, 
it searches for a program named LOAD on the diskette in disk drive 1. If 
that program exists, it is placed in memory and run. 

■ Multiple Statement Lines — TI Extended BASC allows more than one 
statement to be on a line. This feature speeds program execution, saves 
memory, and allows logical units (for example FOR-NEXT loops] to be on a 
single line. 

■ SAVE and LIST Prctection — You may protect your programs from being 
s£ved or listed, preventing unauthorised copies of and changes in your 
programs. This, in conjunction with the copy protection feature of the 
Disk Manager Module, can completely secure a TI Extended BASIC 
program, 

■ IF-THEN-ELSE — Tnc IF-THEN-ELSE statement now allows statements as 
the consequences of the comparison. This expansion permits statements 
such as '"IF X<4 THEN GOSUB 240 ELSE X=X+ 1". 

■ Multiple Assignments — TI Extended BASIC allows you to assign a value 
to more than one variable in a LET statement, saving statements and 
permitting more efficient programming. 

■ Comments — In addition to :he REM statement, comments can be added 
to the ends of lines n TI Extended BASIC, allowing detailed internal 
documentation of programs. 

■ Assembly Language Support — With the optional Memory Expansion unit 
(available separately), TMS9900 assembly language subprograms may be 
loaded and run. The subprograms INIT. LOAD LINK, arid PEEK are used 
to access assembly language subprograms. There are no facilities for 
writing assembly language programs jn the TI-99/4 Home Computer. 

■ Information. — The SIZE command has been added to tell you how much 
memory remains unused in your computer. Tie VERSION subprogram 
returns a value which indicaLes the version of BASIC that is in use. The 
CHARPAT subprogram returns a character string indicating the pattern 
which defines a character. 

■ Memory Expansion — Tl Ex.ended BASIC allows the use of an optional 
Memory Expansion peripheral which permits much larger programs to be 
written, 

Tl Extended T J ASIC S 



INTRODUCTION 



CHAPTER 



CHANGES FROM TI BASIC 

The enhancements described above have made some slight changes 
necessary in othsr areas of TI BASIC. Because of these, some programs 
written in TI-99/4 BASIC may not run in TI Extended BASIC. 

■ The maximum program size is now 864 bytes smaller than in TI BASIC. If 
you have the Memory Expansion peripheral, muc!i larger programs may 
be written. 

■ The characters in character sets 15 and 16 are no longer available. That 
memory area is used by TI Extended BASIC to keep track of sprites 

■ Most programs written in TI BASIC will also run in TI Extended BASIC 
without difficulty. Under certain circumstances, hswever, such as using a 
TI Extended BASIC keyword as a variable in a TI BASIC program, 
programs written in TI BASIC may not run in TI Extended BASIC. 
However, you can always load TI BASIC programs into TI Extended 
BASIC. Programs using the enhancements of TI Extended BASIC will not 
run correctly in TI BASIC. 

HOW TO USE THIS MANUAL 

This manual assumes that you are already experienced in programming with 
TI BASIC. Statements, commands, and functions that are the same as in TI 
BASIC are only discussed briefly here. For a complete discussion, see the 
Users Reference Guide that came with your TI-99/4 Home Computer. 

The additional features of TI Extended BASIC are explained in detail and 
illustrated with examples and programs. To get the maximum use from TI 
Extended BASIC, read this manual carefully, entering and running the 
sample programs to see how they work. Even features that are unchanged 
from TI BASIC should be reviewed. You may find that you have been 
neglecting a useful statement or discover a r.ew way to use statements in 
different combinations. 

The remainder of this chapter reviews the basics of operating with TI 
Extended BASIC. The second chapter discusses the features of TI Extended 
BASIC and includes a detailed example or entering a program. The third 
chapter discusses the conventions of operation with TI Extended BASIC. The 
fourth chapter is a reference section which discusses, in alphabetical order, 
all TI Extended BASIC commands, statements, and functions. 

The 14 appendices contain much useful information, including ASCII 
character codes, error codes, color codes, keyboard codes, and instructions 
on how to add suffixes to speech words. 



1 



HOW TO USE THE COMPUTER 

Before using the computer with TI Extended BASIC, you must insert the 
Solid State Software™ Command Module into the computer. If the computer 
is off, slowly slide the module into the slot on the console until it is in place, 

Th*n turn the computer on. (If you have peripherals, turn them on before 
turning on the computer.) The master title screen appears. If the computer is 
already on, return to the master title screen. Thsn slide the moduie Into the 
slot. 

Press any key to make the master selection list appear. The title cf the 
module, TI EXTENDED BASIC, is third on the list. Type 3 to select TI 
Extended BASIC. 

OPERATING IN TI EXTENDED BASIC 

There are three main operating modes in TI Extended BASIC: Command 
Mode, Edit Mode, and Run Mode. 

Command Mode is the mode entered when you choose TI Extended BASIC 
on the master selection list. In the Command Mode you may enter TI 
Extended BASIC commands, statements that may be used as commands, 
and program lines. 

Edit Mode is used to edit existing lines of a TI Extended BASIC program. To 
enter Edit Mode, type a line number and press either SHIFT E (UP} or SHIFT X 
(DOWN). (TI BASIC also allows EDIT followed by a line number, which TI 
Extended BASIC does not allow.) The line specified is then displayed on the 
scieen. You may change it by typing a new line, by typing over part of the 
old line, or by using :he editing keys dscussed below. You are also in the 
Edit Mode when you press SHIFT R (REDO) to repeat a program lire or 
command. 

In Run Mode, a TI Extended BASIC program is executed You can stop a 
running program only by pressing SHIFT C (CLEAR), which causes a 
breakpoint, or with SHIFT Q (QUIT). JVote: SHIFT Q (QUIT) also erasss the 
entire program, returns you to the master title screen, and may delete 
Information from some of your files. The use of BYE is recommended in place 
of SHIFT Q (QUIT) to leave TI Extended BASIC. 



10 



TI Extended BASIC 



TI Extended UASIC 



11 



INTRODUCTION 



CHAPTER 



mEsmsmmmm 
QQ3EQ00na0 

Bam ma ma mm ei 



SPECIAL KEY FUNCTIONS 

The following are the keys that have a special function when pressed at the 
same time as the SHIFT key: E, D, S, X, R, T. Q, F, C, Q. Each of ihese keys is 
discussed below. 

SHIFT E (UP) is used in the Edit Mode. If you are not iri the Edit Mode, you 
may enter it by typing a line number and then pressing SHIFT E (UP). The 
line specified is then displayed on the screen and may be edited. If you are 
already in the Edii Mode, pressing SHIFT E (UP) enters the present line as you 
have changed It and displays the next lower numbered line in the program. 
Pressing SHIFT E (UP) when you are at the lowest numbered line in the 
program returns you to the Command Mode. If you are entering a line in the 
Command Mode. SHIFT E (LP) has the same effect as ENTER. 

SHIFT D (RIGHT) moves the cursor one space to the right. The cursor does not 
erase or change the characters as it passes over them. At the end of a line on 
the screen, the cursor wraps around to the next screen line. When the cursor 
is at the end of an input line, it does not move. 

SHIFT S (LEFT) moves the cursor one space tc the left. The cursor does not 
erase or change characters as it passes over them. If the cursor is at the 
beginning of a line, the cursor does not move If the cursor is at the left 
margin but not at the beginning of an input line, the cursor goes to the right 
margin of the screen line above it. 



1 



SHIFT X (DOWN) is used in the Edit Mode. If you are not ir the Edit Mode, you 
may enter it by typing a line number and then pressing SHIFT X (DOWN). The 
line specified by the line number is then displayed on the screen and may be 
edited. If you are in the Edit Mode, pressing SHIFT X (DOWN) enters the 
present line as you have changed it and displays the next higher numbered 
line in the program. Pressing SHIFT X (DOWN) when you are at the highest 
numbered line in the program returns you to the Command Mode. If you are 
entering a line in the Command Mode, SHIFT X (DOWN) has the same effect 
as ENTER. 

SHIFT R (REDO) causes the characters on the line previously input to 
reappear on the screen. Thus if you wish to enter a line similar to the most 
recently entered line, press SHIFT R (REDO). If you enter a line and make a 
mistake, you can recall the line using SHIFT R (REDO) and correct it using the 
Edit Mode features. This key lets you avoid retyping a long line. 

SHIFT T (ERASE) erases all characters on the current line, but leaves the 
cursor on that line. If you are in the Command Mode, the cursor returns to 
the left margin of the screen and you may enter a new lire, including the line 
number. However, if you are editing a line or the computer is providing the 
line numbers (through the use of NUM). the line number is not erased. 

SHIFT G (INSERT) instructs the computer to accept inserted characters. Each 
subsequent key that you type is inserted at the cursor position and the 
character at the cursor position and all characters to the right of the cursor 
are shifted one position to the right. Insertion continues vith each character 
typed until ENTER or one of the other special function keys is pressed. 
Characters at the end of a long input line may be lost, 

SHIFT F (DELETE) deletes the character that the cursor is on and shifts all 
characters to the right of the cursor one position to the left. 

SHIFT C (CLEAR) performs different functions depending on the mode that 
you are in. If you are in the Edit Mode, any changes that were made to the 
line are ignored, including SHIFT T (ERASE), and the computer returns to 
Command Mode. If you are in Run Mode, the program is stopped with a 
.breakpoint. If you are in Command Mode, the characters that you have typed 
on the current line are deleted When using SHIFT C (CLEAR) to stop a 
■ program, hold the keys down until TI Extended BASIC recognizes the 
breakpoint. 



12 



TI Ex Leaded 13 ASIC 



TI Extended L ASIC 



13 



INTRODUCTION 



CHAPTER 



2 



SHIFT Q (QUIT) returns the computer to the master title screen. When you 
press SHIFT Q (QUIT), all data and program material are erased from the 
computer's memory. If you are using a disk system, some oj your data files 
may be lost Leave TI Extended BASIC by entering BYE instead of using 
SHIFT Q (QUIT). e 

ENTER indicates that you have finished typing the informatior on the current 
line and are ready for the computer to process it. 



Overview of 

TI Extended BASIC 



This chapter briefly describes the TI Extended BASIC commands, 
statements, and functions and suggests ways in which you can use them. 
The first eight sections are Commands; Assignments and Input; Output; 
Functions. Subroutines, and Subprograms; Sound, Speech, and Color; 
Sprites; Debugging; and Error Handling, The final section is an example of 
the entry of a program showing the entry process and the use of some of the 
TI Extended BASIC elements. 



14 



TI Extended B AS IC 



Tl Extended IUSIC 



15 



OVERVIEW OF Tl EXTENDED BASIC 



CHAPTER 



COMMANDS 

Commands tell the computer to perform a task immediately (that is, as soon 
as you press ENTER), white statements are executed when a program is run. 
In TI Extended BASIC many commands can be used as statements, and 
most statements :an be used as commands A list of all the commands, 
statements, and Junctions is given in Appendix B, indicating the commands 
that can be used as statements and the statements that can te used as 
commands, 

NEW 

To remove a program from TI Extended BASIC to prepare the computer to 
accept a new program, use the NEW command. Programs are also removed 
from me;nory by the OLD command and the RUN command when used with 
a file name. 

NUMBER and RESEQUENCE 

When you are entering a program, the computer assigns line numbers for 

you if yo j enter the NUMBER command. If you wish to resequence the line 

numbers of a program after it is written, use the RESEQUENCE command, 

LIST 

To review the program that you hare entered, use the LIST command. The 
program ean be listed on the screen or to a peripheral device, 

RUN 

The RUN command instructs the computer lo perform, or '"execute," a 
program. The RUN command may be followed by a line number to have it 
start program execution at a specific line, or by a device and filename to load 
and execute a program from a diskette, 

TRACE, UNTRAC5, BREAK, UNBRSAK, and CONTINUE 
All of these commands are related to "debugging" a program, which is 
finding a problem that causes an error condition or an incorrect result. These 
commands are discussed further in the "Debugging and Error Handling- 
section of this chapter. 

SAVE. OLD. MERGE, and DELETE 

When you are finished working on a program, you may want to store it on a 
cassette or diskette for later use. The SAVE command, followed by the name 
of the storage device and a program name, performs this task ior you. Then, 
when you wish to reuse, lis;, edit, or change a program, you can load it into 
memory with the OLD command. If a program has been saved using the 
merge option, you can combine it with a program already in memory with 
the MERGE command. When you have no further use for a prcgram that has 
been saved on diskette, you can remove it with the DELETE cemmand, 



2 



SIZE 

The SIZE command lets you determine how much memory space is left, so 

vou can decide whether to continue to add program lines or end the program 

and have a second program run from the first program with RUN used as a 

statement. 

BYE 

When you have finished using TI Extended BASIC, use the BYE command to 

return to the master title screen. 

Several of the commands (RUN, BREAK. UNBREAK, TRACE, UNTRACE, 
and DELETE) can also be used as statements in programs 

ASSIGNMENTS AND INPUT 

This section discusses statements in TI Extended BASIC taat assign values 
to variables and enter data into programs. 

LET and READ 

If you know what values are to be assigned to variables, use LET or READ 

statements. LET is used when you are assigning a fairly small number of 

values or are calculating values to be assigned, and READ is used, in 

conjunction with DATA and RESTORE, when you are assigning numerous 

values. 

INPUT and LINPUT 

When you want the user of the program to assign values, it is customary to 
give a prompt that asks for the necessary information. INPUT allows you to 
give a prompt and accept input. INPUT only allows the entry of values at the 
bottom of the screen and cannot check to see that the data entered is the 
type of information the program expects. The final limitation on INPUT is 
that commas and quotation marks affect what is entered. With LINPUT, 
there is no editing of what is input, so commas and quota;ion marks can be 
input. Both INPUT anc LINPUT may be used to input data from files on 
cassettes and diskettes. 

ACCEPT 

ACCEPT allows input from most screen positions. Using ACCEPT eliminates 
the necessity of entering data at the bottom of the screen and the "scrolling" 
Of the INPUT statement. However, ACCEPT doesn't allow a prompL as the 
INPUT statement does Therefore, a PRINT or DISPLAY statement must be 
Included in the program to tell the user the type ^f entry that is required. 
ACCEPT can check the input to see that it is numeric, alphabetical, or 
specific characters. ACCEPT is for screen and keyboard use only. 



16 



T Extended BASIC 



TI Extended BASIC 



17 



OVERVIEW OF TI EXTENDED BASIC 



CHAPTER 



CALL KEY and CALL JOYST 

CA P LL KEY a , SinglC key ,' S a1 ' th3t the Pr ° gram USeris re 1 uired to ^. then 
i-ALL KEY ca " * used. For example, if a Y for "yes" or N for "no" - ,h 

-qu-red respond, use the CALL KEY statement to aecept h entry CAIX 

KEY does not display a character on the screen Ii scans the Lv^L 

portion of the keyboard to see if a key has bee" ™Z Th, ™ T " * 

record KEY I*" «* * ** ■™*S -SS Th ^T^ 

recorded as a character, but rathe- as the A^rn ™/L f ,l . 

STEP CAU nrRAfrX ^ DISTANCE - CALL ERR. FOR-TO- 
VERsioN ' GCHAR - CALL POS1TION ' NE ^- CALL SPGET. and CALL 

-RR speches the error that occurred and where it occurred CAUCC^ 
whet?" aer C,e ; h iS m a glVe " *"*" ,OCaUO " CALL POS™^ 
indicates the version of BASIC in use. ' VE NSION 

FOR-TO-STEP anc NEXT deserve special comment. The FOR-TO STFP 

FOR-TO-STEP sta^ment ° U,S,de the ra "« e S P ccl " ed J » ^ 

OUTPUT 

This section discusses the TI Extended BASIC statements whinh , 

output data during program execution. Usually o Ztntf /h^ l ° 

informal** on the screen, printing cata on a primer „ r sav 1n^H , P ayi " g 

external device. However, output car a.so involve ch a L ne The* t™, ?" 

screen, changing the colors of charaders. making nX?/ !- LOl0r ° f tht ' 

sending data to peripheral devices * *' s P eakln g- or 



2 



18 



PRINT, DISPLAY, PRINT.. .USING, DISPLAY... USING, and IMAGE 
The two most frequently used output statements are PRINT and DISPLAY. 
The print separators (comma, semicolon, and colon) and the TAB function 
are used to control the placement of information as it is output. PRINT 
displavs items at the bottom of the screen and scrolls them upward, one line 
at a tline. With DISPLAY, you can display data almost anywhere on the 
screen without scrolling. DISPLAY can also clear tie screen, erase characters 
on a line, and cause a beep. 

PRINT... USING and DISPLAY... USING are like PRINT and DISPLAY except 
that the format of the printed or displayed characters is determined by the 
USING clause, possibly In conjunction with an IMAGE statement. The USING 
Clause allows exact control of the format. PRINT and PRINT.. .USING, 
possibly in conjunction with IMAGE, are the only output statements that car 
be used to send data to an external device. 

CALL HCHAR, CALL VCHAR. and CALL SPRITE 

CALL HCHAR and CALL VCHAR place a character at any screen position 
and optionally repeat it horizontally or vertically. CALL SPRITE displays 
' 'sprites" on the screen. Sprites are graphics that can be moved smoothly in 
any direction and changed in pattern, size, and color. CALL SPRITE and the 
other statements related to sprites are discussed later in this chapter. 

CALL SCREEN and CALL COLOR 

In addition to displaying characters and data on the screen, you can change 
the color of the screen and the colors of the characters. CALL SCREEN sets 
the screen color. CALL COLOR specifies the foreground and background 
colors of characters or the color of sprites. 

CALL SOUND and CALL SAY 

CALL SOUND outputs sounds. A wide range of sounds is available. In 

additian. CALL SAY (possibly used with CALL SPGET) makes the computer 

speak if you have a Solid State Speech™ Synthesizer attached to your 

Computer. 

FUNCTIONS, SUBROUTINES, AND SUBPROGRAMS 

TI Extended BASIC prcvides extensive functions and subprograms for 
handling numbers and characters. In addition, you may construct your own 
(unctions and write your own subprograms and subroutines. 

Functions are TI Extended BASIC language elements that return a value. 
Usually based on parameters given to the function. Many functions are 
mathematical in nature; others control or affect the result sr output produced 
by the statements in which they occur. The TI Extended BASIC functions are 
. ABS ASC, ATN. CHR$, COS, EOF, EXP. INT, LEN. LOG. MAX, MIN, PL 
POs! REC. RND, RPT$. SEGS, SGN, SIN SQR. STR$, TAB, TAN, and VAL. 



TIExiendrdUASIC 



TI Extended BASIC 



19 



OVERVIEW OFTI EXTENDED BASIC 



CHAPTER 



Built-in Functions 

The fo llowing ^^ dlscusses each buflt ^ 

Rmchon Vch« Returned anrfCbmnMnte 

Absolute value of a numeric expression 

S^ET ASC " COdC ° f ttC ** C »— r of a string 

2K melriC arCta " gent ° f a " U ™'* expression *«» in 
Character that corresponds to an ASCII code 
Trigonometric cosine of a numeric f ™.- 
Enc-offile condition of a file * " *"*" * radians ' 

Exponentia, value M of a numeric expression 
Integer value of a numeric expression 
Number of characters in a string expression. 
Natura. logarithm of a numeric expression 
Larger of two numeric expressions 
Smaller of two numenc expressions 
"■ with a value of 3.141592654 

SE ° f "* *« — ee „ one string expression wilhin 
Current record position in a file, 
Random number from to 1 

Strmg equivalent of a numeric expression 

Br* tangCm ° ra "™ C -P-Sion g iv,„ in 
Numer, value of a strin, express which ^^ g 



ABS 
ASC 

ATN 

CHRS 

COS 

EOF 

EXP 

INT 

LEN 

LOG 

MAX 

MIN 

PI 

POS 

REC 
RND 
RPTS 

SEGS 

SGN 

SIN 

SQR 

STR$ 

TAB 

TAN 

VAL 



2 



Unwr-Defl*** Functions 

r)EF is used to define your own functions. Functions up to one line in length 
may be defined, with up to one argument. Longer functions may be 
constructed by having n?w definitions refer to previously defined functi 

.. . n .,o.r Innrf fnnrtinn*; miefht Vip mnrp fffir'ipntlu ianH1i*H with cuKmn 



ions. 
nes 



constructed oy riavmg new ueiiniuuns reier 10 previously aennea Iunctio 
However, long functions might be more efficiently candled with subrouti 
or subprograms. 

Subroutines 

QOSUB and ON...GOSUB are used to call subroutines. A subroutine is a 
series of statements designed to perform a task anc is normally used in a 
program when it performs a task several times. By using GOSUB or 
ON.«.GOSUB, you do not have to type the same lines of code several Limes. 
The subroutine can use the values of any variable in the program and 
change those values. 

Built-in Subprograms 

Built-in subprograms are TI Extended BASIC elements that perform special 
functions. They always are accessed with the CALL statement. The built-in 
subprograms are CHAR, CHARPAT, CHARSET. CLEAR, COINC, COLOR, 
DELSPRITE, DISTANCE, ERR, GCHAR, HCHAR, INIT, JOYST, KEY LINK, 
LOAD, LOCATE, MAGNIFY, MOTION. PATTERN, PEEK, POSITION, SAY, 
SCREEN, SOUND, SPGET. SPRITE. VCHAR, and VERSION 

Built-in subprograms perform many different tasks Some of the 
subprograms affect the display ard determine what key has been pressed on 
the keyboard. 



Buitt-in 
Subprogram 
CLEAR 
COLOR 

GCHAR 

Jhchar 

iJOYST 



[KEY 
! SCREEN 
VCHAF 



Action and Comments 

Clears the screen. 

Specifies the colors of characters in character sets or the 

color of sprites. 

Returns :he ASCII code of the character at a screen position. 

Displays a character on the screen and optionally repeats it 

horizontally. 

Returns values indicating the position of the Wired Remote 

Controllers (optional). 

Returns a code indicating the key Lnat has been pressed. 

Specifies the color of the screen. 

Displays a character on the screen and optionally repeats it 

vertically. 



TI Extended BASIC f Tl Extended BASIC 



OVERVIEW OF Tl EXTENDED BASIC 



CHAPTER 



Built-in subprograms can also define and control sprites. 



Built-in 
Subprogram 
CHAR 



Action and Comments 

Specifies the pattern for a character used for a sprite or a 

graphic. 

COENC Determines if two sprites or a sprite and a point on the 

screen are at or near the same location on the screen. 
COLOR Specifies the color of a sprite or a character set. 

DELSPRITE Dele:es sprites. 

DISTANCE Determines the distance between two sprites or a sprite and 

a location. 
LOCATE Specifies the position of a sprite. 

MAGNIFY Changes the size of sprites. 

MOTION Specifies the motion of a sprite. 

PATTERN Specifies the character that defines a sprite. 

POSITION Determines the position of a sprite. 

SPRITE Defines sprites, specifying the character that defines them, 

their color, their position, and their motion. 

A third category of built-in TI Extended BASIC subprograms involves sound 
and speech. 



Built-in 
Subprogram 
SAY 

SOUND 
SPGET 



Action and Comments 

Causes the computer to speak words when used in 

conjunction with the Solid State Speech™ Synthesizer. 

Generates sounds. 

Retrieves the codes that make speech. 



Four built-in subprograms are only used with machine language 
subprograms obtained from Texas Instruments or another source written in 
TM59900 machine language on another computer. Machine language 
subprograms cannot be written on the TI-99/4 Home Computer. Detailed 
instructions on the use of INIT, LINK. LOAD, and PEEK are provided with 
machine language subprograms. 



2 



finally there are some miscellaneous built-in subprograms. 



Built-in 
Subprogram 
CHARPAT 
CHARSET 

ERR 

VERSION 



Action and Comments 

Returns a value that identifies the pattern of a character. 

Resets characters 32 through 95 to their original pre-defined 

patterns and colors. 

Returns values which give informa;ion about an error that 

has occurred. 

Specifies the version of BASIC that is being used. 



User-Written Subprograms 

You may write your own subprograms. They are a series of statements 
designed to perform a task. They may be used in a program when you 
expect to perform the task several times or to perform the same task in 
several different programs. Using the MERGE option when you save a 
subprogram allows it to be included in other programs. 

When a subprogram is in a program, it must follow the main program. The 
structure of a program must be as follows: 
Start of Main Program 



Subprogram Calls 



End of Main Program 



Start of First Subprogram 



End of First Subprogram 



Start of Second Subprogram 



The program will stop here 
without a STOP or END 
statement. 
Subprograms are optional. 



Nothing may appear between 
subprograms except remarks and 
the END statement. 



22 



Tl Extended BASIC 



End of Second Subprogram 
End of Program 



Only remarks and END may 
appear after the subprograms. 



Tl Extended BASIC 



23 



OVERVIEW OF Tl EXTENDED BASIC 



CHAPTER 



2 



Subprograms are called by the use of CALL followed by the subprogram's 
name and an optional list of parameters and values. The first line of a 
subprogram is SUB. followed by the name of (he subprogram and optionally 
followed by a list of parameters. 

The subprograms you write are not part of the main program. They cannot 
use the values of variables in the main program, so any values hat are 
needed must be supplied by the parameter list in the CALL statement. 
Variable names ma/ be dupicates of those in the main program or other 
subprograms without affecting the values of the variables in the main 
program or other subprograms. Subprograms may call other subprograms, 
but must rot call themselves, either directly or indirectly. 

SUBEND must be the last statement In a subprogram. When that statement 
is executed, control returns to the statement following the statement that 
called the subprogram. Control may also be returned by the SUBEX1T 
statement. 

SOUND, SPEECH, AND COLOR 

You may highlight important sections of your programs' s output through the 
use of sounds, speech, and colors. This "human engineering" makes the 
program easier and more interesting to use. 

CALL SOUND 

SOUND outputs sounds. Tores may be output in lengths of from .001 to 4.25 
seconds at volumes from (loudest) to 30 ( softest). The frequency range is 
from 1 10 (A below low C) to 44733 (above the range of human hearing). In 
addition, 8 noises are available. Up tc three tones and one noise may be 
produced at the same time, Appendix D lists the frequencies that are used to 
produce the musical notes. 

CALL SAY and CALL SPGET 

SAY produces speech when a Texas Instruments Solid State Speech™ 
Synthesizer (sold separately) is attached to the console. You can choose 
among 373 letters, numbers, words, and phrases (listed in Appendix L). En 
addition, you can construct new words from old by combining words. For 
example. SOMK + THING produces "something" and THERE +- FOUR 
produces "Lherefore." 

SPGET is used to retrieve thi* speech codes that produce speech. These 
patterns can then be used to produce more natural speech and can be used 
to change words. Because making new words is a complex process, it is not 
discussed in this manual. However, suffixes can be added rather simply. 
Appendix 14 tells hew to add the suffixes I NG, S, and ED to any word, so that 
words such as ANSWERING. ANSWERS. ANSWERED, INSTRUCTING, 
INSTRUCTS, and INSTRUCTED are included n the computer's vocabulary. 



CALL COLOR and CALL SCREEN 

COLOR changes the colors of character sets and determines sprite colors. 
SCREEN specifies the color of the screen as one of the sixteen colors 
available on the TI-99/4 Home Computer. 

SPRITES 

Sprites are graphics that can be displayed and moved on the screen. One 
advantage that sprites have over other characters is that they can be at any 
of 49,152 positions of 192 rows and 256 columns rather than one of the 768 
positions of 24 rows and 32 columns used by statenents such as CALL 
VCHAR and CALL HCHAR. Because of this greater resolution, sprites can 
move more smoothly than characters. Alsc, once set in motion, sprites can 
continue to move without further program control . 

CALL SPRITE 

CALL SPRITE defines sprites. This subprogram specifies the character 

pattern that sprites use, their color, their position, and, optionally, their 

motion. 

CALL CHAR and CALL MAGNIFY 

Although you may use any of the predefined characters, numbers 32 
through 95, as a sprite, CALL CHAR is generally used to define a new 
pattern for a sprite. Up tc four 8 by 8 dot characters may be used to form a 
sprite. The MAGNIFY subprogram controls the resolution and size of sprites. 

CALL COLOR. CALL LOCATE, CALL PATTERN, and CALL MOTION 
Once a sprite is set up. it can be altered by various subprograms. COLOR 
changes the color of a sprite. LOCATE moves the sprite to a new position. 
PATTERN changes the character that defines a sprite. MOTION alters the 
motion of a sprite. 

CALL COINC. CALL DISTANCE, and CALL POSITION 

Three subprograms provide information about sprites while a program is 

running, COINC returns a value that indicates if sprites or a sprite and a 

point on the screen are ai or near the same place on the screen. DISTANCE 

returns a value that specifies the distance between .wo sprites or a sprite and 

a point on the screen. POSITION returns values that indicate the position of a 

sprite. 

CALL DELSPRITE 

CALL DELSPRITE allows you to delete sprites. If you prefer, you may "hide" 

sprites by locating them off the bottom of the screen. 



24 



Tl Extended BASK' Tl Extended BASIC 



25 



OVERVIEW OF Tl EXTENDED BASIC 



CHAPTER 



2 



DEBUGGING 

Debugging a program is finding logical or typing errors in a program. 
BREAK, CONTINUE, TRACE, ON BREAK, UNBREAK. UNTRACE, and 
SHIFT C (CLEAR) aie most often used in debugging. 

BREAK, ON BREAK, CONTINUE, and UNBREAK 

BREAK causes the computer to stop program execution so that you can print 
the values of variables or change their values. BREAK also resets characters 
to their standard colors (black on transparent! , restores the standard screen 
color (cyan), restores the standard characters (32-95) to their standard 
representation, and deletes sprites. 

ON BREAK tells the computer what to do if a break occurs. You can use this 
statement to tell the computer to ignore breakpoints that you have entered in 
the program. CONTINUE causes the computer to continue program 
execution after a breakpoint UNBREAK cancels any breakpoints set with 
BREAK. Note: If you have put ON BREAK CONTINUE, the computer will not 
stop when you press SHIFT C (CLEAR]. 

TRACE and UNTRACE 

TRACE causes the computer to display each line number before the 
statement(s) on that line is (are) executed. Using this statement allows you to 
follow the sequence of operation of a program. UNTRACE cancels the 
operation of TRACE. 

ERROR HANDLING 

You may include statements in a program to handle errors that occur while 
the program is running. 

CALL ERR. ON ERROR, ON WARNING, and RETURN 
CALL ERR returns information indicating where an error has occured and 
what the error is. Appendix N lists the error codes that are returned. ON 
ERROR specifies what the computer does if an error occurs. ON WARNING 
specifies what the computer does if a condition arises that would normally 
cause a warning message to be issued. RETURN is used with CW ERROR in 
addition to its use with GOSUB. It repeats execution of the statement that 
caused the error, returns to :he statement following the one that caused the 
error, or transfers control to some other part of the program that avoids the 
error that has occurred. 



PROGRAM ENTRY EXAMPLE 

Now thet you've had a brief overview of the features of TI Extended BASIC, 
you may enjoy reviewing or even entering and experimenting with a 
demonstration program. This section demonstrates a number of the useful 
features of TI Extended BASIC. By following the suggestions in this section. 
you canleam some useful shortcuts in the entry process. 

This program allows you to play a game called Codebreaker. In playing it, 
you determine the length of a code (1 to 8 digits). Then you decide the range 
of digits that may be included in the code (up to tenk The computer selects 
the digils in the code without repealing digits. You then guess what the 
digits are and their sequence. After each guess, the computer tells you how 
many digits you guessed correctly and how many are in the correct place. (If 
you repeat a digit in your guess, it is counted as right each time it appears.) 
Using this information, you guess again. You win when you guess all the 
digits ccrrectly and place them in the proper sequence, 

For example, suppose you've chosen to play the game using four digits with 
each digit being any one of nine numbers (0, 1, 2, 3. 4. 5, 6, 7, or 8). The 
code the computer chooses might tie 0743, which you are trying to break. 
Here is a possible sequence of guesses. 

EXPLANATION OF THE 

COMPUTER'S RESPONSE 

is righl four times, once in the right place. 

3 and 4 arc right, but not in the right place. 

7 is right, but not in the right place. 

3 and 4 are right, and 4 is in the rigfr place. 

All right, Oand 4 in the right place. 

All right, 4 in the right place 

All right, Oand 7 in the right place. 

All right, all in the right place. You win. 

To begin entering the example, turn on any peripheral devices you have 
connected to the computer. Insert the TI Extended BASIC Command Module 
and turn on the computer. Press any key to go to th? master selection list. 
Prifcss 3 to select TI Extended BASIC. 

In the following, ;he characters vou tvpe and the keys you press are 
UNDERLINED. 



GUESS 


RIGHT 


PLACE 


0000 


4 


1 


1234 


2 





5678 


1 





2348 


2 


1 


0347 


4 


2 


3047 


4 


1 


0734 


4 


2 


0743 


4 


4 



26 



TI Extended BASK ' 



uSIC t»E) 



Ex tented BASIC 



27 



OVERVIEW OF Tl EXTENDED BASIC 



CHAPTER 



CODEBREAKER Program Entry 
COMMENTS 

Automatically numbers the program 

lines. 

Title and language. 

Reserves room for tiie codes and 

guesses. 

Makes the codes random. 

Clears the screen, beeps, and puts 

the title CODEBREAKER on the 1 1th 

row starting in the 9th column. 

REDO repeats whatever was done 

before ENTER was last pressed. Using 

the edit keys [SHIFT G (INSERT). 

SHIFT F (DELETE), £nd the arrows], 

change line 130 to: 140 DISPLAY 

AT(19,1)BEEP:" NUMBER OF 

CODES? (l-8)\ 

Beeps and displays MUMBER OF 

CODES? (1-8) on the 19th row 

starling at the first column. 

Press SHIFT R (REDO) again. Mow 

change line 140 to: L50 DISPLAY 

AT(21.6)BEEP: "DIGITS EACH 

CODE?". 

Beeps and displays DIGITS EACH 

CODE? on the 21st row starting at 

the 6th column. 

Accepts into CODES an entry on the 

19th line, 24th column, allowing 

only digits to be entered. 

Change line 160 to: 170 ACCEPT 

AT(21,24) VALIDATE(DIGIT): 

DIGITS. 

Accepts into DIGITS an entry on the 

2 1st line, 24th column, allowing only 

digits to be entered. 



DISPLAY 

* READY * 
>NUM 



ENTER 



>100 REM CODEBREAKER XEASIC ENTER 
>110 DIM C0DE$(8),GUESS$(8) ENTER 



>120 RANDOMIZE 



ENTER 



>130 DISPLAY AT(11,9)BEEP ERA 
SE ALL: '-CODEBREAKER 1 ' ENTER 



>140 



SHIFT R 



140 DISPLAY AT( 19,1) BEEP r'NU 

MBER 0? CODES? (1-8) - ENTER 

> SHIFT R 



150 DISPLAY AT(21,6)BEiP:' J DI 

GITS EACH CODE? - ENTER 

>160 ACCEPT AT( 19. 24) VALIDATE 
(DIGIT j : CODES ENTER 

> SHIFT R 



170 ACCEPT AT(21,24)VALIDATE 
(DIGIT) :DIGITS ENTER 



2 



Displays the program as it is 
currently entered. 



Runs the program. 

Screen clears, then this appears: 



> LIST 
100 REM CODEBREAKER XBASIC 
110 DIM C0DE$(8),GUESS$(8) 
120 RANDOMIZE 

130 DISPLAY AT (11, 9) BEEP ERA 
SE ALL: "CODEBREAKER" 
140 DISPLAY AT(19,1)BEEP:"NU 
MBER OF CODES? (1-8)" 
150 DISPLAY AT(21,6)BEEP:"D[ 
GITS EACH CODE?" 
160 ACCEPT AT( 19,24) VALIDATE 
(DIGIT): CODES 

170 ACCEPT aT(21,24) VALIDATE 
(DIGIT) :DIGITS 



>RUN 

CODEBREAKER 
NUMBER OF CODES? (1-8) 
DIGITS EACH CODE? 



Enter anything except a digit. The computer beeps and does not accept it. 
Enter 4. The cursor moves down to the second prompt. Enter 10. The 
program ends and you can continue entry. 

* READY * 



Numbers lines starting with 180. 
Checks o see that there will be 
enough digits for the number of 
codes. If CODES is less than or equal 
to DIGITS, control passes to the next 
line. If CODES is greater than 
DIGITS, the message NO MORE 
CODES THAN DIGITS is displayed 
on the last line of the screen, and 
control is transferred to line 160 
again. 



>NUM 180 

>180 IF C0DES>DIGITS THEN DI5 
PLAY AT (24 >2) BEEP: 1 W MORE C 
0DE£ THAN DIGITS": ;G0T0 160 ENTER 



28 



TI Extended BASIC 



Tl Extended BASIC 



29 



OVERVIEW OF Tl EXTENDED BASIC 



CHAPTER 



Starts the loop to choose the codes. 
The words after the exclamation 
point are a comment. 
Chooses codes at random. 

Starts the bop to prevent duplicate 

codes. 

Checks for duplicates. Chooses a new 

code if there is a duplicate. 

Finishes duplicate check loop. 

Finishes code choice loop. 

Sets a variable to keep track of 

where information is displayed on 

the screen. 

Clears the screen and displays a 

column heading on the top line. 

REDO line 260 so it reads: 270 

DISPLAY AT(24,3):' ENTER X" FOR 

SOLUTION*. 

Displays an instruction at the bottom 

of the screen. 

Numbers lines starting at 280. 

Accepts the guess at the proper row. 

Checks for giving up or resetiing. 

Begins loop to break up the guess to 

check it for accuracy. 

Separates guess into individual 

digits. 

Completes loop to separate guess. 

Sets RIGHT and PLACE to zero. 
Begins outside loop to check the 
guess against the code. 
Begins inside loop to check guess. 
If a guess doesn't match a code, goes 
to the next ]Jne. If a guess matches a 
code, adds one to the number 
correct. Then if the guess is in the 
correct place, adds oie to the 
number in the correct place. 



>190 FCR A*l TO CODES iCHOOSE 
CODES ENTER 

>200 CCPE$(A)=STR$(INT(RND*DI 
GITS)) ENTER 

>210 FCR B=0 TO A-l ! CHECK FO 
R DUPLICATES ENTER 

>220 IF C0DE$(A)=C0DE$(B) THE 

N 200 ENTER 

>2^0 NEXT B ENTER 

>240 NEXT A ENTER 

>250 R0tf=2 ENTER 



>260 DISPLAY AT( 1,1) ERASE ALL 

:" GUESS RIGHT PLACE 11 ENTER 

>270 SHIFT R 



270 DISPLAY AT- 24,3) : " ENTER 

f X' FOR SOLUTION " ENTER 

>NUM 280 ENTER 

>280 ACCEPT AT(R0W J 1):C$ ENTER 
>290 IF C$="X" THEN 470 !GIVE 

UP OR RESET ENTER 
>300 FOR D=l TO CODES I3REAK 

UP GUESS ENTER 

>310 GUISS$(D)=SEG$(C$,3 t l) ENTER 

>320 NEXT D ENTER 

>330 RIGHT, PLAC^Q ENTER 

>340 FOR E=l TO CODES 1 CHECK 

GUESS FOR CORRECTNESS ENTER 

>350 FOR F=l TO CODES ENTER 

>360 IF C0DE$(Ej=GUES5$i:f) TH 
EN RIGFiT=RIGHT4l::IF E=F THE 
N PLACE=PLACE+1 ENTER 



2 



Completes inside loop. 

Completes outside loop. 

Displays the number of digits that 

are correct. 

REDO line 390 to be: 400 DISPLAY 

AT (RCW,22):PLACE. 

Displays the number of digits that 

are in the correct place. 

Numbers lines starting at 410. 

Checks to see if the code has been 

solved. If it has, goes to the next line. 

If It has not adds one to the row. 

Then if the row is more than 22, 

goes to line 470 and gives the 

solution. Otherwise, returns to line 

280 to accept another guess. 

Displays the win message with the 

number of guesses at the 23rd row 

starting at the first column. 

REDO line 420 to be: 430 DISPLAY 

AT(24,1) BEEP:"PLAY AGAIN? (Y/N) 

Y". 

Displays the prompt PLAY AGAIN? 

(Y/N) Y at the 24th row starting at 

the first column. 

Numbers lines s;arting at 440. 

Accepts an entry into X$ on the 24th 

row, 19th column. Does not remove 

any character that is already there 

(In this case, a Y from the DISPLAY 

Statement in line 430). accepts only 

One character, beeps, and accepts 

; imly YorN. Pressing ENTER at this 

. : j>omt when the program is running 

Jtsonfirms the Y that was displayed by 

Jlne 430. 

t£ Y is entered, returns to line 190 

%nd chooses a new code far another 

^Igame. 

^ Stops the program. 



>370 NEXT F ENTER 

>380 NEXT E ENTE* 

>390 DISPLAY AT (ROW ,14): RIGHT ENTER 

>A0Q SHIFT R 

400 DISPLAY AT (ROW, 22): PLACE ENTER 



>NUE 410 ENTER 

>4l0 IF PLACEOC0DES THEN ROW 
=R0W+1::IF RQW>22 THEN 470 E 
LSE280 ENTER 



>420 DISPLAY AT(23,1)BEEP:"Y0 
U WIN WITH";R0W-lj "GUESSES." ENTER 



>430 



SHIFT R 



430 DISPLAY AT ( 24,1) BEEP :"PL 

AY AGAIN? (r/N) Y " ENTER 



>NUH 440 



ENTER 



>440 ACCEPT ftT(24,19)SIZE(-l) 
BEE? VALIDArE("YN"):X$ ENTEP 



>450 IF X$ = -''f M THEN 190 



>460 STOP 



ENTER 



ENTER 



30 



Tl Extended BASIC /Tl Extended BASIC 



31 



CHAPTER 



OVERVIEW OF Tl EXTENDED BASIC 



Dsplays the message THE CODE IS 
at the 23rd row. 1st column 

Begins a loop to display the digits. 
Displays the digits. 

Finishes the loop. 
Leave the number mode. 
Press DOWN ARROW as if to edit 
line 430 so you can use SHIFT R 

(REDO). 



ENTER 
ENTER 



>470 DISPLAY AT (23,1) BEEF : M TH 
E CODE IS" I LOSE, GIVE UP, 
R RESET 

>480 FOR G=l TQ CODES 

>490 DISPLAY A7(23,12+G) :CODE 

$(G) ENTER 

>500 NEXT G ENTER 

>510 ENTER 

> 43Q DOWN ARROW 

430 DISPLAY AT(24,l)BEEP: "PL 

AY AGAIN? (Y/N) Y" ENTER 



Press REDO. Line 510 is a duplicate > 

ofline 430, so change the line 

number to 510, 

Displays the prompt. PLAY AGAIN? 

(Y/N) Y at the 24th row starting at 

the 1st column. 

Press DOWN ARROW as if to edit 

line 440 so you can use SHIFT R 

(REDO). 



SHIFT R 



510 DISPLAY AT( 24,1) BEEP: "PL 

AY AGAIN? (Y/N) Y" ENTER 

> 440 DOWN ARROW 

440 ACCEPT AT(24,19)SIZE(-1) 
3EEP VALIDATE("YN"):X$ ENTER 



Press REDO. Line 520 is a duplicate > 

ofline 440. so change the line 

number to 520. 

Accepts an entry inLo XS on the 24th >520 ACCEPT AT (24, 19) SIZE (-1) 



row, 19th column. Does not remove 
any character that is already 
displayed (in this case a Y from the 
DISPLAY statement in line 510), 
accepts only one character, beeps. 
ar.d accepts only Y or N. Pressing 
ENTER at. this point A^hen the 
program is running confirms the Y 
that was displayed by line 510, 
If Y is entered, returns to line 130, 
allows changing the number of digits 
in a code and the number of 
acceptable digits, and starts a new 
game. 



BEEP VALIDATE ("YIT):X3 



SHIFT R 



ENTER 



> 53Q IF X$="Y" THEN 1?Q 



ENTER 



2 



Before running a program, you should proofread it Here is a list of the entire 
progra-n for you to check against your program list. 

100 REN CODEBREAKIR XBASi: 
110 DIM C0DE$(8),GUESS$(8) 
120 RANDOMIZE 

1)0 display at(11,9)beep era 

se all:"codebreaker" 

140 display at(19,1)beep:"nu 

mber of codes? (1-8)" 

150 display at(21,6)beep:"di 

g:ts each code?" 

160 accept at(19,24)validme 

(digit): codes 

1*0 accept at(21,24)validate 

(digit) :digits 

180 if codes>dighs then dis 

play at(24,2)beep:"no more c 

odes than digits": :g0t0 150 

190 for a=l to codes i ch03se 

CODES 

2g0 code$;a)=str$(int(rnd*di 

g:ts)) 

210 for b-0 to a-l !n0 dupli 

Gates 

220 if code$(a)=cdde$(b) the 

N 200 

230 NEXT B 

2<v0 NEXT A 

250 R0W=2 

260 DISPLAY AT( 1,1) ERASE ftLL 

: "GUESS RIGHT PLA3E" 

2*0 DISPLAY AT(24,3): "ENTER 

'I' FOR SOLUTION" 

2&0 ACCEPT AT(R0W,1) :C$ 

290 IF C$="X" THEN 470 IGIVE 

UP OR RESET 
300 FOR D=l TO C03ES ! BREAK 
U? GUESS 



32 



TI Extended BASIC 



TI Extended BASIC 



33 



OVERVIEW OF Tl EXTENDED BASIC 



310 GUESS$(D)=SEG$(C$,D,1) 

320 NEXT D 

330 RIGHT, PLACE=0 

340 FOR E=l TO CODES ! CHECK 

GUESS 

350 FOR F=l TO CODES 

360 :f code$;e)=guess$(f) TH 

EN R:GHT=RIGHT+1::IF E=F THE 

N PLACE^PLACE+l 

370 NEXT F 

380 NEXT E 

390 DISPLAY AT ( ROW, i;): RIGHT 

400 DISPLAY aT(R0W, 22) :PLACE 

410 IF PLACEOCODES THEN ROW 

=R0W+1::IF R0tf>22 THEN 470 E 

LSE 280 

420 DISPLAY AT(23,X)BEEP: 'TO 

U WIW WITH "; ROW- 1; "GUESSES." 

430 DISPLAY iT(24,l)BEEP: "PL 

AY ACAIN? (Y/N) Y" 

440 ACCEPT AT(24,19)SIZE(-1) 

BEEP VALIDATE("YN"):X$ 

450 IF X$="Y THEN 190 

460 STOP 

470 DISPLAY AT(23,1)BEEP:"TH 

E CODE IS" !L0SE, GIYE UP, 

R RESET 

480 FOR G=l 70 CODES 

490 DISPLAY /.T(23,12+G):C0DE 

$(G) 

500 NEXT G 

510 DISPLAY £T(24,1)BEEP:"PL 

AY ACAIN? (Y/N) Y" 

520 ACCEPT A7(24,19)SIZE(-1) 

DEEP VALIDATE ("YN' ■):)($ 

530 IF X$="Y" THEN 1J0 



CHAPTER 



2 



flow run the program fcy typing RUN and pressing ENTER. Choose 4 codes 
with 10 digits [0, 1, 2, 3, 4, 5, 6, 7, 8, and 9) possible in each code. Guessing 
the code in six tries is excellent. Finding it in eight is very good. 

If you wish to use the program again, save it on diskette or cassette. To save 
It on cassette, make sure the cassette player is connected. Then enter SAVE 
CS1 and follow the instructions that appear on the screen, 

To save the program on diskette, enter SAVE DSK 1 .filename with whatever 
filename you wish to use to save it, such as CODEBREAK. 

After saving the program, or if you do not wish to save the program, enter 
NEW. The program is removed and you may enter another program. 

If you have saved the program, you can easily reload it into the computer's 
memory for reuse or further ediling. Reload the program from a cassette by 
entering OLD CS1 and then following the instructions that appear on the 
screen. Reload the program from diskette by entering OLDDSKl./Uename 
using whatever file name you used to save it. 

When you have finished using TI Extended BASIC, enter BYE to return to 
the master title screen. 



34 



TI Extended BASIC f ^ Extmded RASIC 



35 



CHAPTER 



3 

TI Extended BASIC 
Conventions 



This chapter discusses the format that TI Extended BASIC programs must 
take and the ways in which TI Extended BASIC functions. 



36 



TI Extended BASIC Tl Extended BASIC 37 



Tl EXTENDED BASIC CONVENTIONS 



RUNNING A PROGRAM ON POWERUP 

If a program named LOAD is on the diskette in disk drive 1 when TI 
Extended BASIC is chosen, that program is loaded and run. The effect is the 
same as if you had entered RUN "DSKl.LOALT. If the program does not 
exist, there is a momentary delay while TI Extended BASIC looks for it. 

FILES 

Files are groups of data put on external devices. The most common files are 
on cassettes or diskettes, but data sent through external devices such as the 
RS232 Interface and the optional thermal printer are also considered to be 
files by TI Extended BASIC. 

LINE NUMBERS 

Line numbers are required in TI Extended BASIC programs. Lire numbers 
specify the order in which lines are executed and are used to identify what 
lines to execute next when using IF-THEN-ELSE. GOTO, GOSUB, ON 
ERROR, ON. ..GOTO, and ON.. .GOSUB. Line numbers may also be used by 
BREAK, LIST, NUM RESTORE, RETURN, and RUN. Line numbers maybe 
any integer from 1 through 32767. 

The computer automatically generates line numbers if you issue the NUM 
command. When not followed by a line number, it provides line numbers 
starting at 100. incrementing each subsequent line by 10. You nay 
resequence line numbers with the RES command. 

LINES 

Lines may be up to 140 characters long, including the line number and 
spaces. If you have reached the end of a line, additional characters you enter 
replace the 140th character, It is possible to make a line longer than 140 
characters in the Edit Mode by the use of SHIFT G (INSERT). 

SPECIAL SYMBOLS 

Special symbols separate statements and remarks on the same line. A line of 
TI Extended BASIC consists of a line number, one or more Tl Extended 
BASIC statements, and an optional remark. For example: 
100 FOR A= 1 TO 100::PRINT A;SQR|A)::NEXT A 'PRINT SQUARE ROOTS 

The statement separator symbol, a double colon (::), is used to separate 
statements on the same line. The tail remark symbol, an exclamation point 
(I), is used to separate an explanatory remark from the rest of the line. 
Remarks are not executed when the program is run. 



CHAPTER 



3 



SPACES 

Spaces are required in TI Extended BASIC between the elements that make 
Up statements to enable the computer to distinguish variable names from TI 
Extended BASIC elements. However, spaces are not required before or after 
relational symbols or before or after the ta.l remark symbol or the statement 
separator symbol. You may insert extra spaces when inputting commands 
and statements, but they are deleted by Tl Extended BASIC. When listing 
programs. TI Extended BASIC may add spaces around the tail remark 
symbol and statement separator symbol. 

NUMERIC CONSTANTS 

Numeric constants may be entered with any number of digits. However, they 
are rounded to 13 or 14 digits by the computer due to the internal storage 
method used by the computer, and are normally displayed as a maximum of 
10 digits. For extremely large or small numbers, it is usually more 
convenient to use scientific notation to enter numbers. The computer 
normally uses scientific notation when printing very large or small numbers. 

In scientific notation, a number is given as a mantissa (a number with one 
place to the left of the decimal point) times 10 raised to an integer power. 15 
is expressed in scientific notation as 1.5 x 10 1 . 150 is expressed as 1.5 x 10 2 ; 

- 1,500 is expressed as - 1.5 x 1C 3 : 156,789,000,000,000 is expressed as 
L56789xl0 14 ; and 0,155789 is expressed as 1.56789 x 10 -». In TI Extended 
BASIC, The "x 10 ,+ is represented by "E". Thus 1 5x 10 3 becomes 1.5E3. 

Numeric constants are defined in the range -9.9999999999999E127 to 

- 1E-128, 0, and lE-128to 9.9999999999999E127. If the exponent of a 
calculated number is greater than 99,, then * * is normally printed or 
displayed as the power. The entire exponent is kept internally and can be 
displayed with a USING clause in a PJUNT or DISPLAY statement. 

STRING CONSTANTS 

String constants in TI Extended BASIC can be up to one input line long. If 
$he string is enclosed in quotation marks, quotation marks :n the string are 
|tepresented by double quotation marks. 

Variables 

Variables in TI Extendec BASIC may consist of one to 15 characters. The 
jjrst character of a variable must be a letter of the alphabet, the at symbol 

Ijfch or an underline ( ). Subsequent characters may be these symbols plus 

fay of the digits. The last character of a string variable must always be a 
foliar sign ($). Variables are either scalar or arrays with up to seven 
dimensions. 



38 



TI Extended BASIC 



I Extended BASIC 



39 



Tl EXTENDED BASIC CONVENTIONS 



CHAPTER 



Certain words are reserved for use by TI Extended BASIC. They are the 
commands, statements, functions, and operators that make up the language. 
These words may not be used as a variable name, but they may make up 
part of a variable name. The Following is a complete list of the wsrds reserved 
forTI Extended BASIC, 



AHS 

ACCEPT 

ALL 

AND 

APPEND 

ASC 

AT 

ATN 

BASE 

BEEP 

BREAK 

BYE 

CALL 

CHR$ 

CLOSE 

CON 

CONTINUE 

COS 

DATA 

DEP 

DELETE 

DIGIT 

DIM 

DISPLAY 

ELSE 

END 



EOF 

ERASE 

ERROR 

EXP 

FIXED 

FOR 

GO 

GOSUB 

GOTO 

IF 

IMAGE 

INPUT 

INT 

INTERNAL 

LEN 

LET 

LIN PUT 

LIST 

LOG 

MAX 

MERGE 

MIN 

NEW 

NEXT 

NOT 

NUM 



NUMBER 


SEQUENTIAL 


NUMERIC 


SGN 


OLD 


SIN 


ON 


SIZE 


OPEN 


SQR 


OPTION 


STEP 


OR 


STOP 


OUTPUT 


STRS 


PERMANENT 


SUB 


PI 


SUBEND 


POS 


SUBEXIT 


PRINT 


TAB 


RANDOMIZE 


TAN 


READ 


THEN 


REC 


TO 


RELATIVE 


TRACE 


REM 


UALPHA 


RES 


UNBREAK 


RESEQUENCE 


UNTRACE 


RESTORE 


UPDATE 


RETURN 


USING 


RND 


VAL 


RPTS 


VALIDATE 


RUN 


VARIABLE 


SAVE 


WARNING 


SEGS 


XOR 



The following are examples of valid variable names: 

Numeric: X A9, ALPHA. BASE_PAY V(3). T(X,Y,Z,Q,A,R.P6), 

TABLE(Q37,M/4) 

String: S$, VZ2S. NAMES, 95$(X.7.L/2), ADDRESS6(4) 



3 



JfUMERIC EXPRESSIONS 

Numeric expressions are constructed from numeric constants, numeric 
variables, and functions using the arithmetic operators for addition (+ ). 
subtraction ( - ) multiplication (*), division (/), and exponentiation (A ). 

The minus sign ( - ) can be used either to indicate subtraction or as a unary 
jtninus. As a unary minus, it reverses the sign of what follows it. For 
example. - 3 A 2 is equal to - 9 as it is taken to mean - (3 A2), 

>3The normal hierarchy for evaluating a numeric expression :s exponentiation. 
JfoHowed by multiplication and division, and then by addition and 
fjfcubtraction. However, any part of a numeric expression that is enclcsed in 
'parentheses is evaluated first. The following shows the effect of parentheses 
-pn determining the value of an expression: 



Intermediate Results 
4 + 4/2-6 4+2-6 

6A2/2-6 36/2^6 

4. + 4/{ _ 4) 4 _ i 



Final 
Value 



12 

3 



Expression 
S4+2A2/2-6 
^4 + 2)a2/2-6 

§1 + 2 A 2/(2 -6) 

String expressions 

ptring expressions are constructed from string variables, string constants, 
:,|ind function references jsing the operation for concatenation (&) to combine 
iPtrings. If a constructed string exceeds a length of 255 characters, the extra 
|$haraeLers on the right are truncated and a warning message is issued. The 
t^ollo wing is an example af concatenation: 



il*V". 



100 A$="hT"&" THERE!" 



|A$= "HI"&" THERE!" sets AS equal to "HI THERE;!". 

RELATIONAL EXPRESSIONS 

-.^Relation a) expressions are most often used in the IF-THEN -ELSE statement, 
;^>ut may be used anywhere that numeric expressions are allowed. A 
.Jl^lational expression has a value of - 1 if it is true and a value of if it is 
^false. Relational operations are performed, from leit to right, after all 
'|£rithrrjetic operations are completed and before string concatenation (the 
^ampersand operator). The relational expressions arc: 
|fequal to ( = ) Not equal to (< >) 

$!Less than (< ) Less than or equal to (< = ) 

greater than ( >) Greater than or equal to { > = ) 



40 



TI Extended BASIC 



Tl Extended BASIC 



41 



CHAPTER 



Tl EXTENDED BASIC CONVENTIONS 



>100 IF X<Y THEN 200 E1£E GO 
SUB 420 



The following examples illustrate the use of relational expressions: 

IF X<Y THEN 200 ELSE GOSUB 

420 next executes lne 200 if X is 

less than Y. If X is greater than or 

equal to Y, then the statement 

GOSUB 420 is executed. 

IFL(C)= 12 THEN C = S+1 ELSE >100 IF L(C)=L2 THEN C^S+1 E 

COUNT = COUNT + ;::GOTO 140 sets LSE C0UNT=C0UNT+1 : :G0T0 140 
C equal to S plus 1 if L(C) equals 12. 
If L(C) is not equal to 12, then 
COUNT is set equal to COUNT plus 1 
and line 140 is executed next. 

A = 2<5 se:s A equd to - 1 as it is 
true that 2 is less than 5. 



>100 A=2<5 



THIS"="THAT" 



PRINT "THIS" = "THAT" prints as > 100 PRINT 
it is not true that "THIS" is equal to 
"THAT", 

A = B = 7 sets A equal to - 1 if B is > 100 A=B=7 
equal to 7, and to if B is net equal 
to 7. There is no effect on B. Note 
that this is not the same as the usual 
arithmetical meaning of A = B = 7. 

LOGICAL EXPRESSIONS 

Logical expressions are used with relational expressions. The logical 
operators are AND, OR. NOT and XOR, If true, logical expressions are given 
a value of - 1. If false, they are given a value of 0. The order of precedence 
for logical expressions, from highest to lowest, is NOT, XOR, AND. and OR. 

A logical expression using AND is true if both its left and right causes are 
true. 

A logical expression using OR is true if either its left clause is true, its right 
clause is true, or both its left and right clauses are true 

A logical expression using NOT is true if the clause following it is not true. 

A logical expression using XOR (exclusive or) is true if either its left or its 
right clause is true, but not both its left and right clauses are true. 



3 



>100 IF 3<4 AND 5>6 THEN L=7 



>100 IF 3<4 OR 5>6 THEN L=7 



>100 IF 3<4 XOR 5>6 THEN L=7 



>100 IF 1<4 XOR 5<6 THEN U7 



>100 IF NCT 3=A AM) (NOT 6=5 
XOR 2=2) THEN 200 



The following examples illustrate the use of logical expressions: 
IF3<4 AND 5<6 THEN L = 7 sets L >100 IF 3<4 AND 5<6 THEN L=7 
equal to 7 since 3 is less than 4 and 
5 is less than 6. 

IF3<4 AND 5>6THEN L = 7 does 
not set L equal to 7 because 3 is less 
than 4, but 5 is not greater than 6. 
1F3<4 0R5>STHEN L = 7 sets L 
equal to 7 because 3 is Jess than 4. 
IF3<4XOR 5>6THEN L = 7 sets L 
equal to 7 because 3 is Jess than 4 
and 5 is not greater than 6. 
IF3<4XOR5<6THEN L = 7 does 
not set L equal to 7 because 3 is less 
than A and 5 is less than 6. 

IF NOT 3 = 4 THEN L = 7 sets L equal >100 IF NOT 3=4 THEN L=7 
to 7 because 3 is not equal to 4. 
IF NOT 3 = 4 AMD(NOT6 = 5X0R 
2 = 2) THEN 200 does not pass 
control to line 200 because while it is 
true that 3 is not equal to 4, it is true 
that both 6 is not equal to 5 and 2 is 
equal to 2, so the clause in 
pareniheses is not true. 
IF (A OR B) AND (C XOR D) THEN 
200 passes control to line 200 if 
cither A or B or both A and B are 
true (equal to - 1). and C or D, but 
, not both C and D are true (equal to 

5 The logical operators can also be used directly on numbers. They convert the 
^numbers to binary notation, perform the designated operation on a bit level. 
j&and then convert the result back to decimal representation A more detailed 
^discussion of the use of logical operators with numbers can be found in a 
fjmathematics or engineering text dealing with logic. 

;$The numbers must be irom -32.768 to 32,767, represented in binary 
flnotatbn as from 1000000000000000 to 1 1 1 1 1 1 : 1 1 1 1 1 1 1 1 . with negative 
| ! numbers given in 2's complement form signified by a 1 in the most 
■$ Significant bit. In binary notation, each place is an additional power of 2 
$■■' rather than an additional power of 10 as n decimal notation. The following 
iy Shows numbers in both decimal and binary notation. 



>100 IF (A OR B) AND (C XOR 
D) THEN 200 



42 



TI Extended BASIC % TI E *tended BASIC 



43 



Tl EXTENDED BASIC CONVENTIONS 



CHAPTER 



1 1C = OOO0OOOOOO0OOOOl a = 1 2 25 10 = 00000000001 1001 2 = 11001^ 

6 1C = 0000000000000110 3 = 110 2 -13,o = 1 11 11 11 11 1110011 a 
AND places a 1 in the corresponding binary position if there is a 1 in both 
the number preceed:ng and following it. Otherwise it places a zero. 
OR places a 1 in the corresponding binary position if there is a 1 in either the 
number preceeding :t or following it or both. Otherwise it places a zero. 
XOR places a 1 in the corresponding binary position if there is a 1 in either 
the number preceedng it or following it but not both. Otherwise it places a 
zero. 

NOT places a 1 in the corresponding binary position if there is a zero in the 
number following it. Otherwise it places a zero 

The following illustrate the result of the logical operators when Lsed on 
numbers. 



A: 

B: 

A ANDB: 

A; 

B: 

A AND B: 



A: 

B: 

A OK B: 

A: 

B 

A OR B: 



A: 

B: 

A AOR B: 

A: 

B: 

A *OR Br 



A: 

NOT A: 
A: 
NOT A: 



DECIMAL 
L 
2 

6 
5 
4 

DECIMAL 
I 
2 
3 
6 



DECIMAL 
1 
2 

6 
5 

3 

DECIMAL 

1 

2 

6 

-7 



BINARY 

ooooooooooooooo 1 
O00OOO0O0OOOOO10 

0000000000000000 

OOOOOOOOOOOOO ! 1 
OOOOOOOOOOOOO 1 1 

0000000000000 1 oo 

BINARY 

000000000000000 1 
ooooooootooooo 1 

0O0O000OCOOO0O1 1 
OOOOOOOOCOOOO J 1 
OOOOOOOOCOOOO 1 1 
OOOOOOOOCOOOO! I I 

BINARY 

OOOOOOOOCOOOOOO I 

aoooooooflooooo i o 

00000000000000 1 1 
DOOOOOOOOOOOOl 10 
XKJOOOOOOOOOO 1 1 
^OOOOOOOOOOOOO 11 

B1SARY 

xjoooooomooooo i 

111 ] I 1 1111111110 
OOOOOOOOOOOOO 1 10 
11111111111 11001 



A: 

B: 

A AND B: 

A: 

B: 

A AND B; 



A; 
B. 
AOR a; 

A: 

B: 

A OH tf: 



A: 

B: 

A XOK B. 

A: 

B: 

A XOH B: 



A: 

NOT A-. 
A: 
NOT A 



DECIMAL 

1 

3 

1 
47 
62 
46 

DECIMAL 

1 

3 

3 
47 
62 
63 

DECIMAL 

1 

3 

2 
47 
62 
17 

DECIMAL 
2 

-3 

47 

-48 



BINARY 

OOOOOOOOOOCOOOO 1 
OOOOOOOOOOCOOO 1 1 
OOOOOOOOOOCOOOO t 
OCO00OO0OO10111 t 
0030000000111110 
OCOOOOOOOO 10 1 1 10 

BINARY 

OOOOOOOOOOCOOOO 1 
OOOOOOOOOOOOOO 1 1 
OOOOOOOOOOCOOO 1 1 
00X000000101111 

0030000000 111110 

0030000000 111111 

BINARY 
0030000000000001 
0030000000000011 
00300000000000 1 
OO'JOOOOOOOlOllll 
0OXJOO0OOO11I11U 
OOOOOOOOOOOl 000 ] 

BINARY 
00100000000300 1 o 

liiiniiinti ioi 

0010000000131111 
llllllllllOlOOOO 



4 





DECIMAL 












BINARY 


















PLACE 












FLACK 
















- 


100 


10 1 


- 


163S4 


8192 


4096 


204S 


1024 


512 


25S 


128 


64 


31 16 H 


4 


2 L 


■1 







1 








O 


O 








o 


O 








coo 





1 







6 
































COO 


1 


1 







2 5 
































C 1 1 


o 


1 


••<>■ 


T 1 ! 


O 


1 3 




1 


1 


1 


) 


1 


1 


1 


1 


1 


J ] o 





1 1 





Reference Section 




(This chapter is an alphabetical list of all of the TI Extended BASIC 
\ commands, statements, and functions, with a detailed explanation of how 
] each works. Examples and sample programs are included wherever 
fitiecessary for clarity. 

Jin the format of the elements, key words are CAPITALIZED. Variables are in 
^italics. Optioned portions are enclosed in [brackets]. Items that may be 
^■repeated are indicated by elipses (...). Alternative forms are presented one 
'if above the other. 

#V-, 

% ; : Appendix A contains a list of the illustrative programs. The Index gives the 
fj pages on which each TI Extended BASIC elemeni is used in an illustrative 
.■$;. program. 



44 



TI Extended BASIC: 



TI Extended BASIC 



45 



ABS 



Format 

ABS( numeric-exp ress ion) 

Description 

The ABS function gives the absolute value of numeric-expression. If 
numeric-expression s positive, ABS gives the value of numeric expression. If 
numeric-expression ;s negative. ABS gives its negative {a positive number). If 
numeric-expression is zero, ABS returns zero. The result of ABS :s always a 
non-negative number. 

Examples 

PRINT ABS(42.3) prints 42.3. 



VV=ABS{ 
6.124. 



>100 PRINT ABS(42J) 
-6.124) sets VV equal to >100 V7=ABS(-6.124) 



ACCEPT 



CHAPTER 



4 



format 

ACCEPT | [AVrowxolumn}] [VALIDATE [datatype ,...]] [BEEP] 
[ERASE ALL1 [SIZE( numeric-expression)] :] variable 

Description 

The ACCEPT statement suspends program execution until data is entered 
from tie keyboard. Many options are available with ACCEPT, making it far 
more versatile than INPUT. It may accept data at my screen position, make 
Z audible tone (beep) when ready to accept the data, erase all characters on 
the screen before accepting data, limit data accepted to a certain number of 
characters, and limit the type of characters accepted. 

Options 

The following options may appear in any order following ACCEPT. 

AT(rouua>liimii) places the beginning of the input field at the specified row 
and column. Rows are numbered 1 through 24. Columns are numbered 1 
through 28 with column 1 corresponding to what is called column 3 in the 
VCHAR, HCHAR. and GCHAR subprograms. 

VALIDATE {data-type ,...) allows only certain characters to be entered. Date 
type specifies which characters are acceptable. If ™re than one data-type is 
specified, a character fr:>m any of the daia-types given is acceptable. The 
following are the data- types. 

UALPHA permits all uppercase alphabetic characters. 

DIGIT permits through 9. 

NUMERIC permits through 9. *'.'\ " + ", " - , and E . 
Strtng-expression permits the characters contained in string- 
expression. 
BEEP sounds a short tone to signal that the computer is ready to accept 
input 

ERASE ALL fills the enure screen with the blank character before accepting 
input 

SIZE(numerfc expression) allows up to the absolute value of numeric. 
expression characters to be input. If numeric-exfression ,s positive, the field 
in which the data is entered is cleared before input is accepted. If numenc- 
expression is negative, the input field is not blanked. This allows a default 
value to be previously placed in the field and entered by just pressing ENTER. 
If there is no SIZE clause, the line is blanked from the beginning posiuon to 
the end of the line. 

If the ACCEPT statement is used without the AT clause the last two 
characters on the screen (at the lower right) are changed to "edge 
charters" (ASCII code 31). 



46 



TI Extended BASIC 



Tl Expended BASIC 



47 



ACCEPT 



Examples 

ACCEPT AT(5,7):Y accepts data at 
the fifth row, seventh column of the 
screen into the variable Y. 

ACCEPT VALIDATE("YN'):R$ 
accepts Y or N into the variable R$. 

ACCEPT ERASE ALL:B accepts data 
into the variable B af'.er putting the 
blank character into all screen 
positions. 

ACCEPT AT(R,C)SIZE(F1ELDLEN) 
BEEP VAL1DATE(DIGIT."AYN"):X$ 
accepts a digit or the letters A. Y, or 
N into the variable X$. The length of 
the input may be up :o F1ELDLEN 
characters. The data is accepted at 
row R, column C. and a beep is 
sounded before data is accepted. 

Program 

The program a I the right illustrates a 
typical use of ACCEPT. It allows 
entry of up to 20 names and 
addresses, and then c is plays them 
all. 



ACCEPT 



CHAPTER 



>100 ACCEPT AT(5,7):Y 



>100 ACCEPT VALIDATE("YN"):R$ 



>100 ACCEPT ERASE ALL:B 



>100 ACCEPT Al(R,C)SIZE(FIELD 
LEN)EEEP VALIDATE ( DIGIT/ 'AYN 
"):X$ 



>100 DIM NAME3(20),ADDR$(20) 
>110 DISPLAY AT (5,1) ERASE ALL 

r-NAHE: 11 
>120 DISPLAY AT(7,1): 'ADDRESS 

>130 DISPLAY AT(23,1):"TYPE A 

? TO END ENTRY." 
>140 FOR S=l TO 20 
>150 ACCEPT AT(5,7)VAIIDATE(U 

ALPHA/'? 1 ') BEEP SIZE(l3) :NAME 

$(S) 
>160 IF NAME$ (S ) = '■?" THEN 200 
>170 ACCEPT AT(7,10)SIZE(12): 

ADDR$(S) 
>180 DISPLAY AT(7,10):" 



4 



>190 NEXT S 

>200 CALI CLEAR 

>210 DISFLAY AT(1,1) : "NAME", ■' 

ADDRESS l! 

>220 FOR T=l TO S-l 
>230 DISFLAY AT ("+2,1) :NAME$( 

T),ADDR$(T) 
>240 NEX7 T 
>250 GOTO 250 

(Press SHIFT C to stop the 
progran.) 



48 



TI Extended BASIC 



TI Extended BASIC 



49 



ASC 



ATN 



CHAPTER 



4 



Format 

ASC \st ri ng-exp ressio n) 

Description 

The ASC function gives the ASCII character code which corresponds to the 
first character of string-expression. A list of the ASCII codes is given in 
Appendix C. The ASC function is the inverse of the CHRS function. 

Examples 



PRINT ASCr.V) prints 65. 

B = ASC(" 1") sets B equal to 49. 

DISPLAY ASC("HELL<r ) displays 
72. 



>100 PRINT ASC ("A") 

>100 B=/ISC("1") 

>100 DISPLAY ASC ("HELLO") 



Format 

ATN ( n unae rfc-express ion ) 

Description 

The ATN function returns the measure of the angle (in radians) whose 
tangent is numeric-expression. If you wart the equivalent angle in degrees, 
multiply by 180/PI. The value given by the ATN function is always in the 
range - PI/2 < ATN(X) < PI/2. 

Examples 

PRINT ATN(O) prints 0. 



Q = ATN(.44) sets Q equal to 
.4145068746. 



>100 PRIM ATN(O) 
>100 Q=ATN(.44) 



50 



TI Extended BASIC 



TI Extended BASIC 



51 



BREAK 



BREAK 



CHAPTER 



Format 

BREAK [linenumberlist] 

Description 

The BREAK nommani requires a line-number-list. It causes the program 10 
stop immediately before the lines in line-number-list are executed. After a 
breakpoint is taken because the line is listed in Une-number-list t the 
breakpoint is removed and no more breakpoints occur at that line unless a 
new BREAK command or statement is given. 

The BREAK statement without line-number-list causes the program to stop 
when it is encountered. The line at which the program slops is called a 
breakpoint. Every time a BREAK statement without tine-number-list is 
encountered, the program stops even if an ON BREAK NEXT statement has 
been executed. 

You can also cause a breakpoint in a program by pressing SHtFT C (CLEAR) 
while the program is running, unless breakpoints are being handled in some 
other way because of .he action of ON BREAK. 

BREAK is useful in fir ding out why a program is not running exactly as you 
expect it to. When the program has stopped you can print values of variables 
to find out what is happening in the program. You may enter any command 
or statement that can be used as a command. If you edit the program, 
however, you cannot resume with CONTINUE. 

A way to remove breakpoints set with BREAK followed by line numbers is 
the UNBREAK commend. Also if a breakpoint is set at a program line and 
that line is deleted, the breakpoint is removed. Breakpoints are also removed 
when a program is saved with the SAVE command. See ON BREAK for a 
way to handle breakpoints. 

Whenever a breakpoint occurs, the standard character se; is restored. Thus 
any standard characters that had been redefined by CALL CHAR are restored 
to the standard characters. A breakpoint also restores the standard colors, 
deletes sprites, and resets sprite magnification to the default value of 1. 

Options 

The line-number-list is optional when BREAK is used as a statement, but is 
required when BREAK is used as a command. When present, it causes the 
program to stop immediately before the lines in line-number list are 
executed. After a breakpoint is taken because the line is listed in line- 
number- list, the breakpoint is removed and no more breakpoints occur at 
that ine unless a new BREAK command or statement is given. 



4 



Examples 

BREAK as a statement causes a 
breakpoint when that statement is 
executed. 

BREAK 120, 130 as a statement 
causes breakpoints before execution 
of the line numbers listed. 

BREAK 200,300, 1 105 as a command 
causes breakpoints before ex ecu lion 
of the line numbers listed. 



>150 BREAK 



>110 BREAK 120,130 



>BREAK 200,300,1105 



52 



Tl Extended BASIC 



Extended BASIC 



53 



BYE 



Format 

BYE 

Description 

The B^E command ends TI Extended BASIC and returns the computer to 
the master tide screen. AH open files are closed, all program lines are erased 
and the computer is reset. Always use the BYE command instead of SHIFT Q 
(QUIT) to leave TI Extended BASIC. SHIR Q (QUIT) does not close files, which 
may result in data being lost from external devices. 



CALL 



CHAPTER 



4 



Format 

CALL subprogram-name [{parameter-list)] 
Description 

The CALL statement transfers control to subprogram- name. The 
subprogram may be either one built into TI Extended BASIC, such as 
CLEAR, or one you have written. After the subprogram is executed, the next 
statement after the CALL statement is executed. CALL may be either a 
statement or a command for calling built-in TI Extended BASIC 
subprograms, but must be a statement when calling subprograms that you 
write. 

Options 

The parameter-list is defined according to the subprogram you are calling. 
Some require no parameters at all. some require parameters, and some have 
optional parameters. Each built-in subprogram is discussed under its own 
entry in this manual. The subprograms you can write are discussed in the 
section in Chapter II on subprograms and under SUB. The following are the 
subprogram-names of the built-in TI Extended BASIC subprograms, 

PATTERN 

PEEK 

POSITION 

SAY 

SCREEN 

SOUND 

SPGET 

SPRITE 

VCHAR 

VERSION 



CHAR 


HCHAR 


CHARPAT 


INIT 


CHARSET 


JOYST 


CLEAR 


KEY 


COINC 


LINK 


COLOR 


LOAD 


DELSPRITE 


LOCATE 


DISTANCE 


MAGNIFY 


ERR 


MOTION 


GCHAR 





Program 

The program at the right illustrates 
the use of CALL with a supplied 
subprogram (CLEAR) in line 100 and 
the use of a written subprogram 
{TIMES) inline 120. 



>100 CALL CLEAR 
>110 X=4 

>120 CALL TIMES (X) 
>U0 PRINT X 
>l40 STOP 
>200 SUB TIMES(Z; 
>210 Z=Z*PI 
>220 SUBEND 
>RUN 

—screen clears 
12.566^7061 



54 



TI Extended BASIC 



TI Extended BASIC 



55 



CHAR subprogram 



CHAR SUBPROGRAM 



CHAPTER 



Format 

CALLCHAH(charactercode,pattern-identifier [....] ) 

Description 

The CHAR subprogram allows you to define special graphics characters. You 
can redefine the standard set of characters (ASCII codes 32-95) and the 
undefined characters, ASCII codes 96-143. Note that fewer program defined 
characters are available in TI Extended BASIC tnan in TI BASIC, where 
ASCII codes 96-156 are allowed. The CHAR subprogram is the inverse of the 
CHARPAT subprogram. 

Character-code specifies the character which you wish to define and must be 
a numeric expression with a value from 32 through 143. Pattern-identifier is 
a through 64 character string expression which specifies the pattern of the 
character(s) you are defining. This string expression is a coded representation 
of the dots which make up a character on the screen. 

Each character is made up of 64 dots comprising yin 8 by 8 grid as shown 
below. 



ROW 1 
ROW 2 
ROW 3 
ROW 4 
ROW 5 
ROW 6 
ROW 7 
ROW 8 

Each row is partitioned into two blocks of four dots each: 
ANY ROW 



LErr 

BLOCKS 


I 


RIGHT 

BLOCKS 



































































































































LEFT 

BLOCKS 



RIGHT 
BLOCKS 



Each character in the pattern- identifier describes the pattern in one block of 
one rcw. The rows are described from left to right and from top to bottom. 
Therefore the first two characters in the' pattern- identifier describe the 
pattern for row one of the grid, the next two the second row. and sc on. 



4 



BLOCKS 



Characters are created by turning some dots "on" and leaving others "off." 
The space character (ASCII code 32} is a character with all the dots turned 
*'ofT." Turning all the dcts "on" produces a solid block. The color of the on 
dots is the foreground color. The color of the off dots is the background color. 

All the standard characters are set with the appropriate dots on. To create a 
new character, you specify what dots to turn on and leave oft. In the 
computer a binary code, one number for each of the 64 dots, is usee to 
specify which dots are on and off in a particular block. A more human- 
readable form of binary is hexadecimal. The following table shows all the 
possible on/off conditions for the four dots in a given block, and the binary 
and hexadecimal codes for each condition. 

Binary Code 
(0 = Off: l=On) 

0000 

0001 

0010 

0011 

0100 

0101 

0110 

0111 

1000 

1001 

1010 

1011 

1100 

1101 

1110 

1111 

If the pattern-identifier is less than 16 characters, the computer assumes 
that the remaining characters are zeros. If the pattern-identifier is 17 to 32 
characters, two character-codes are defined, the first with the first through 
sixteenth characters and the second with the remaining characters, with 
zeros added as needed. If the pattern- identifier is 33 to 48 characters, three 
character-codes are defined, the first with the first through sixteenth 
characters, the second with the seventeenth through thirty-second 
characters, and the third with the remaining characters, with zeros added as 
leeded. If the pattern-identifier is 49 to 64 characters, four character-codes 
re defined, the first with the first through sixteenth characters, the second 
rith the seventeenth through thirty-second characters, the third with the 
lirty-third through forty-eighth characters, and the fourth with the 
"maining characters, with zeros added as needed. If the pattern-identifier is 
onger than 64 characters or is long enough to define characters higher than 
character code 143, the excess is ignored. 



Hexadecimal 
Code 

1 
2 
3 
4 
5 
6 
7 
8 
9 
A 
B 
C 
D 
E 
F 



56 TI Extended BASIC 



TI Extended BASIC 



57 



CHAR SUBPROGRAM 



Programs 

To describe the dot pattern pictured 
below, you code this string for CALL 

CHAR; 

" 1898FF3D3C3CE404" 

LEFT RIGHT BLOCK 



BLOCKS 



ROW1 
ROW 2 
ROW 3 
ROW 4 
ROWS 
ROWS 
ROW 7 
ROWS 




BLOCKS CODES 

18 
98 
FF 
3D 
3C 
3C 
E4 
04 



The program at the right uses this 
and one other string to make a figure 
"dance." 



If a program stops for a breakpoint, 
the predefined characters (ASCII 
codes 32 through 95) are reset to 
their standard pattern. Those with 
codes 96 through 1 43 keep their 
program defined pattern. When Lhe 
program ends normally or because of 
an error, all predefined characters 
are reset. 



>100 CALL CLEAR 

>110 A$="1898FF3D3C3CE404" 

>120 B$="1819FFBC3C3C272Cr 

>130 CALL C0LOR(9,7,12) 

>140 CALL VCHAR( 12,16,96) 

>150 CALL CHAfi(96,A$) 

>160 G3SUB 200 

>170 CALL CHAR(96,B$) 

>180 G3SUB 200 

>190 GOTO 150 

>200 FOR DELAY=1 TO 50 

>210 NEXT DELAY 

>220 R2TURN 

>RUN 

— screen clears 

— character moves 

(Press SHIFT C to stop the 
program. ) 

>100 CALL CLEAR 

>110 CALL CHAR;96,"FFF;FFFFF 

FFFFFFF") 
>120 CALL CHARi42,"0F0FOFOF0 

FOFOFOF") 
>130 CALL HCHAfi(l2,17,42) 
>140 CALL VCHAR(U, 17,96) 
>150 FOR DELAY=1 TO 500 
>160 NEXT DELAY 
>RUN 



CHARPAT subprogram 



CHAPTER 



4 



Format 

CALL QHARPATicharacier-codeMring-variable [,...] ) 
Description 

The CHARPAT subprogram returns in string-variable the 16-character 
pattern identifier that specifies the pattern of character-code. The CHARPAT 
subprogram is the inverse of the CHAR subprogram. See the CHAR 
subprogram for an explanation of the value returned in string-variable. 



Example 

CALL CHARPAT(33.C$) sets C$ 
equal to "OO1O1D101OOO1OO0". the 
pattern identifier for character 33, 
the exclamation point. 



>100 CALL CHARPAT(33,C$) 



58 



TI Extended BASIC 



Tl Extended BASIC 



59 



CHARSET subprogram 



Format 

CALL CHARSET 

Description 

The CHARSET subprogram restores the standard character patterns and 
standard colors for characters 32 through 95. Normally when a program is 
run by another program using RUN as a statement, characters 32 through 
95 are not reset to their standard patterns and colors. CHARSET is useful 
when this feature is not desired. 



Example 

CALL CHARSET restores the 
standard characters and their colors. 



>100 CALL CHARSET 



CHR$ 



Format 

CHRS(numertc-expression) 

Description 

The CHR$ function returns the character corresponding to the ASCII 
character code specified by numeric-expression. The CHR$ function is the 
inverse of the ASC function. A list of the ASCII character codes for each 
character in the standard character set is given in Appendix C. 



Examples 

PRINT CHR$(72) prints H. 

X$ = CHR$(33) sets X$ equal to !. 

Program 

For a complete list of all ASCII 
characters and their corresponding 
ASCII values, run the program on 
the right. 



>100 PRINT CHR$(72) 
>100 X$=CHR$(33) 



>100 CALL CLEAR 
>110 FOR A=32 TO 95 

>120 PRINT A; ;CHR$(A);' 

j 
>130 NEXT A 



CLEAR subprogram 



CHAPTER 



4 



Format 

CALL CLEAR 

Description 

The CLEAR subprogram is used to clear (erase) the entire screen. When the 
CLEAR subprogram is called, the space character (ASCII code 32) is placed 
in all positions on the screen. 



programs 

When the program at the right is 
run, the screen is cleared before the 
PRINT statements are performed. 



If the space character (ASCII code 
32) has been redefined by the CALL 
CHAR subprogram, the screen is 
piled with the new character when 
fcALL CLEAR is performed. 



>1D0 CALL CLEAR 

>110 PRINT "HELLO THERE!" 

>120 PRINT "HOW ARE YOU?" 

>RJN 

— screen clears 

HELLO THERE! 

HOW ARE Y3U? 

MOO CALL CHAR(32,"010307CF1F 

3F7FFF") 
>110 CALL CLEAR 
>120 GOTO 120 
>RITN 
— screen Is filled with A 

(Press SHIFT C to stop th2 

program. ) 



60 



TI Ex '.ended BASIC 



Tl Extended 13 ASIC 



61 



CLOSE 



Format 

CLOSE ^file-number J:DELETE| 

Description 

The CLOSE statement stops a program's use of the file referenced by ^file- 
number. After the CLOSE statement is performed, the file cannot be used by 
the program unless you OPEN it again. The computer no longei associates 
the ^file-number with the closed file, so you can assign that number to 
another file. 

When no program is running, the following actions close all open files: 
Editing the program 
Entering the BYE command 
Entering the RUN command 
Entering the NEW command 
Entering the OLD command 
Entering the SAVE command 
Entering the LIST command to a device 

If you use SHIFT Q (QUIT) to leave TI Extended BASIC, the computer does not 
close any open files, and you may lose data on any files that are open. To 
avoid this possibility, you should leave TI Extended BASIC with BYE instead 
ofSHIFTQ(QUIT). 

Options 

You may delete a diskette file at the same time you close it by adding 
":DELETE" to the statement. Other devices, such as cassette recorders, do 
not allow DELETE. The manual for each device discusses the use of 
DELETE. 



CLOSE 



Examples 

When the computer performs the 
CLOSE statement for a cassette tape 
recorder, you receive instructions for 
operating the recorder. 



CHAPTER 



The CLOSE statement for a diskette 
requires no further action on your 
part. 



4 



>100 OPEN #24 :"CSl", INTERNAL, 
INPUT, FIXED 



--program lines 



>200 CLOSS #24 

>RUN 

—opening instructions 



—program runs 



* PRESS CASSETTE STOP 
THEN PRESS ENTER 



CS1 



>100 OPEN #24:"DSK1,MYDATA",I 
NTERNAL, INPUT, FIXED 



— program lines 



>200 CLOSE #24 
>RUN 

— program runs 



!N 



62 



TI Extended BASX 



$1 Extended BASIC 



COINC subprogram 



Format 

CA LLCOINC(#sprtte-number.#sprife-fUirnber.to/erance.aumerec-uariaWe) 
CALL COlNC{^spritenurnbcr.doL-row t dut-cohimndolerance,nurnertc- 

variable) 
CALL COWCiALL, numeric-variable) 

Description 

The COINC subprogram detects a coincidence between a sprite and another 
sprite or a position on the screen. The value returned in numefcvariable is 
- 1 if there is a coincidence and if there is no coincidence. 

If Lhe keyword ALL is given, the coincidence cf anv two sprites is reported If 
two sprues are identified by ^sprite-number, their coincidence is reported If 
Sprite-number and a location are identified, their coincidence is reported. 

If the keyword ALL is given, sprites are coincident only if one or more of the 
dois which make them up occupy the same position on the screen If two 
sprites or a sprite ar.d a location are given, then tolerance must be specified 
ami two sprites are coincident if their upper left hand corners are within the 
value specified by tolerance. A sprite and a location are coincident if the 
upper left hand corner of the sprite and the position specified by dot-row and 
doi-colurnn are within the value specified by tolerance. These coincidents are 
reported even if there is no apparent cverlap of the sprites or the sprite and 
the position. 

Doi-row and dot-column are numbered consecutively starting with 1 in the 
upper lcit hand corner of the screen. Thus the dot-row can be from 1 to 192 
and the dot*column can be from 1 to 256. (Actually the dot-raw can go up to 
2o6. but the positions from 193 through 256 are off the bottom of the 
screen ) If any part of the spriLc occupies the position given, then there is a 
coincidence. 

Whether or not a coincidence is detected depends on several variables If the 
sprites arc moving very quickly. COINC may not be able to detect their 
coincidence. Also, COINC checks for a coincidence onlv when it is called so a 
program may miss a coincidence that occurs when the program is executing 
some other statement. s 



COINC SUBPROGRAM 



CHAPTER 



4 



program 

The program at the right defines two 
sprites that consist of a triangle. 



Line 160 shows a coincidence 
because the sprites are within 10 
dots of each other. 
Line 1 &0 shows no coincidence 
because the shaded areas of the 
sprites are not coincident. 



>100 CALL CLEAR 

>110 S$="0103070F1F3F7FFF" 

>120 CALL CHAR(96,S$) 

>130 CALL CHAR ( 100, S$) 

>140 CALL SPRITE(#1,96,7,8,8) 

>150 CALL SPRITE(#2,100,5,1,1) 

>160 CALL COINC(#1,02,1O,C) 

>170 PRINT C 

>180 CALL C0INC(ALL,C) 
>L90 PRIM C 
>RUN 
-1 




64 



TI Extended BASIC 



TI Extended BASIC 



65 



COLOR subprogram 



COLOR subprogram 



CHAPTER 



Format 

CALL COLOR[#sprite-numberforeground-color [,...] ) 

CALL COLOR{character-setJoreground-color t backgrowid-color ,...] ) 

Description 

The COLOR subprogram allows you to specify either a foreground-color for 
*sp rite- number or a foreground-color and background-color for characters in 
the character-set. In a given CALL COLOR, you may define sprile colar(si or 
character set colors, but not both. 

Each character has two colors. The color of the dots that make up the 
character itself is called the foreground-color. The color that occupies the rest 
of the character position on the screen is called the background-color. In 
sprites, the background-color is always code 1, transparent, which allows 
characters and the screen color to show through. To change the screen eclor. 
see the SCREEN subprogram. Foreground-color and background-color must 
have values from 1 through 16. The color codes are shown below: 



Color Code 


Color 


1 
2 


Transparent 
Black 


3 


Medium Green 


4 
5 


Light Green 
Dark Blue 


6 

7 


Light Blue 
Dark Rec 


8 


Cvan 


9 


Medium Red 


10 

11 


Light Red 
Dark Yellow 


12 
13 


Light Yellow 
Dark Green 


14 
15 
16 


Magenta 

Gray 

White 



Until CALL COLOR is performed, the standard foreground-color is black 
(code 2) and the standard background-color is transparent (code 1} for all 
characters. Sprites have their color assigned when they are created. When a 
breakpoint occurs, all characters are reset to the standard colors 



4 



To use CALL COLOR you 
sets the character belongs 
While Tl Extended BASIC 
the standard characters is 
are given below: 

Set Number 



1 

2 

3 

4 

5 

6 

7 

8 

9 

10 

11 

12 

13 

14 



must also specify to which of the fifteen character 
. [Note that Tl BASIC hes sixteen character sets 
has fifteen.) The list of ASCII character codes for 
given in Appendix C. The character-set numbers 

Character Codes 

30-31 

32-39 

40-47 

48-55 

56-63 

64-71 

72-79 

80-87 

88-95 
96-103 
104-111 
112-119 
120-127 
128-135 
136-143 



Examples 

CALL COLOR(3, 5,8) sets the 
foreground-color of characters 48 
through 55 to 5 (dark blue) and the 
background-color to 8 (cyan). 

CALLCOLOR(*5,16) sets sprite 
number 5 to have a foreground-color 
of 16 [white). The background-color 
is always 1 (transparent). 

CALL COLOR(*7.INT(RND* 16 + 1)) 
sets sprite number 7 to have a 
foreground-color chosen randomly 
from Ihe 16 colors available. The 
background-color is 1 (transparent). 



MOO CALL COLOR (3, 5,8) 



MOO CALL COLOR (#5 ,16) 



MOO CALL C0L0Ri#7,INT(RND*l6 
+D) 



66 



Tl Exrended BASIC 



Tl Extended BASIC 



67 



CONTINUE 



COS 



CHAPTER 



4 



Format 

CONTINUE 
CON 

Description 

The CONTINUE command restarts a program which has been stopped by a 
breakpoint. It may be entered whenever a program has stopped running 
because of a breakpoint caused by the BREAK command or statement or 
SHIFT C (CLEAR). However, you cannot use the CONTINUE command if you 
have edited a program line. CONTINUE may be abbreviated as CON. 

When a breakpoint occurs, the standard character set and standard colors 
are restored. Sprites cease to exist. CONTINUE docs not restore standard 
characters that have been reset or any coiors. Otherwise, the program 
continues as if no breakpoint had occurred. 



Format 

COSiradian-expresston) 

Description 

The cosine function gives the trigonometric cosine of radian-expression. If 
the angle is in degrees, multiply the number of degrees by PI/ 180 to get the 
equivalent angle in radians. 



Program 

The program on the right gives th'j 
cosine of several angles. 



MOO A=l. 047197551196 

>110 B=60 

>120 C=45*PI/180 

>130 PRINT COS(A);C0S(B) 

>l40 PRINT C0S(B*PI/180) 

>150 PRINT COS(C) 

>RUN 

.5 -.9524129804 

.5 

.7071067812 



68 



TI Extended BASJC 



TI Extended BASIC 



69 



DATA 



Format 

DATA data-list 
Description 

The DATA statement allows you to store data inside your program. The data, 
which may be numenc or string constants, is listed in data-list separated by 
commas. During program execution, the READ statement assigns the values 
in data-list to the variables specified in variable-list in the READ statement. 

DATA statements may be locaLed anywhere in a program. However, the 
order in which they appear is important. Data from several DATA statements 
is read sequentially, beginning with the first item in the first DATA 
statement. If a program has more than one DATA statement, the DATA 
statements are read in the order in which they appear in the program, unless 
otherwise specified by a RESTORE statement. Thus the order in which data 
appears in the program normally determines the order in which data is read. 
DATA statements cannot be part of multiple statement lines. 

Data in data-list must correspond to the type of the variable to which it is 
assigned in the READ statement. Thus if a numeric variable is specified in 
the READ statement, a numeric constant must be in the corresponding 
position in the DATA statement. Similarly, if a string variable is specified, a 
string constant must be supplied. A number is a valid string, so you may 
have a numeric constant in a DATA statement where a siring is called for in 
the READ statement. If a DATA statement contains adjacent commas, the 
computer assumes you want tc enter a null string (a string with no 
characters). 

When using string constants in a DATA statement, you may enclose the 
string in quotes. However, if the string you include contains a comma, 
leading spaces, or trailing spaces, you w.ust enclose the string in quotes. If 
the siring is enclosed in quotes quotes in the string are represented by 
double quotes. 



DATA 



program 

The program at the right reads and 
prints several numeric and string 
constants. Lines 100 through 130 
read five sets of data and print their 
values, two to a line. 



CHAPTER 



4 



Lines 190 through 220 read seven 
data elements and print each on its 
own line. 



First two elements of line 140. 

Second (wo elements of line 140. 

Last element of line 140 and first cf 
|line 150 

|Second and third elements of line 
|150. 

^Fourth and fifth elements of line 150. 
|Line 160. 
jLine 170. 
HLine 180. 

]First element of line 230. 
(Second element of line 230, 

i'r 

jNull string for two commas in line 
230. 
Last element of line 230. 



>100 FOR A=l TO 5 

>110 READ 3,C 

>120 PRINT BjC 

>130 NEXT k 

>i;0 DATA 2,4,6,7,8 

>150 DATA 1,2,3,4,5 

>160 DATA THIS HAS QUOTES" 

>170 DATA " NO QUOTES, HERE 1 ' 
>130 DATA NO QUOTES HERE EITH 

ER 
>190 FOR A=l TO 7 
>20O READ B$ 
>210 PRINT B$ 
>220 NEXT k 
>230 DATA 1, NUMBER,, T I 
>R'JN 

2 4 
6 7 
8 1 

2 3 

4 5 

"THIS HAS QUOTES" 

NO QUOTES, HERE 
NC QUOTES HERE EITHER 

1 
NUMBER 



TI 



70 



TI Extended BASIC 



TI Extended BASIC 



7] 



DEF 



Format 

DEF function-name [{parameter)] = expression 

Description 

The DEF statement allows you to define your own functions. Function-name 
ma\ be any variable name. If you specify a parameter following/uncUon- 
narne, the parameter must be enclosed in parentheses and may be any 
scalar variable name. U I expression is a string, function-name must be a 
string variable name, i.e. the last character must be a dollar sign. 

The DEF statement must occur at a lower numbered line than any reference 
to the function it defines. However, a DEF statement may not appear in an 
IF-THEN-ELSE statement. When the computer encounters a DEF statement 
during program execution, it proceeds x> the next statement without taking 
any action. A function may be used in any string or numeric expression by 
using function-name followed by an expression enclosed in parentheses if a 
parameter was specified in the DEF statement. 

When a reference to t:ie function is encountered in an expression (by using 
function- name in a statement), the function is evaluated using the current 
values of the variables specified in the DEF statement and the value of 
parameter if there is one. A DEF statement can refer to other defined 
functions. However, the function you specify may not refer to itself either 
directly {e.g. DEF B = B*2) or indirectly (e.g. DEF F = G::DEF G = FI. 

Attempting to print the value of a function with PRINT used as a command 
does not wor\ if the Memory Expansion is connected to your computer. 

Options 

If you specify a parameter for a function, when a reference to the function is 
encountered in an expression, its value is assigned to parameter. The value 
of the function is then determined using the value of parameter and the 
values of the other variables in the DEF statement. If parameter is given in 
the DEF statement, an argument value must always be given when referring 
to the function. 

The parameter name used in the DEF statement affects only the DEF 
statement in which it is used. This means that it is distinct from any other 
variable with the same name which appears elsewhere in the program. 

Parameter may not be used as an array. You can use an array element in a 
function as long as the array does not have the same name as parameter. For 
example you may use DEF F(A) - B(Z) but not DEF F(A) = A(Z). 



DEF 



Examples 

DEFPAY(OT) = 40*RATE+ 1.5* 
RATE'OT defines PAY so that ea^h 
time it is encountered in a program 
the pay is figured using the RATE of 
pay times 40 plus 1.5 times the rate 
of pay limes the overtime hours. 

DEF RND2O = INT(RND*20 + 1) 
defines RND20 so that each time it is 
encountered in a program an integer 
from 1 through 20 is given. 

DEF FIRSTWORDS(NAMES) = SEG$ 
(NAMES. l.POS(NAME$," 'M)-l] 
defines FIRSTWORDS to be the part 
of NAMES that preeeeds a space. 



CHAPTER 



4 



>100 DEF PAY(0T)=40*RATE+1.5* 
RATE*0T 



>100 DEF RND20=INT(RND*20+1) 



>100 DEF FIRSTWORDS (NAME?) =SE 
G$(NAME$,1,P0S(NAME$," M)- 
1) 



72 



TI Extended BASIC: 



Tl Extended BASIC 



73 



DELETE 



Format 

DELETE device-filename 

Description 

The DELETE command allows you to remove a program or data file from the 
computer's filing system. Device-filename is a string expression. If a string 
constant is used, it must be enclosed in quotes. You may also delete data files 
by using the keyword DELETE in the CLOSE statement. 

Some devices (such as diskettes) allow deleting files; others (such as 
cassettes) do not. Read the manual for the specific device for more 
information. 



Example 

DELETE "DSKl.MYFiLE" deletes 
the file named MYFILE from the 
diskette in disk drive 1 . 

Program 

The program on the right illustrates 
a use of DELETE. 



>DELETE "DSK1. MYFILE' 



>100 INPUT "FILENAME: ":X$ 
>110 D2LETE X$ 



DELSPRITE subprogram 



CHAPTER 



4 



format 

CALL DELSPRITE(*sprite-number [...-!) 
CALL DELSPRITE(ALL) 
Description 

The DELSPRITE subprogram removes sprites from further access by a 
program. You may delete one or more sprites by specifying their numbers 
preceded by a number sign (*) and separated by commas, or you may delete 
all sprites by specifying ALL. After being deleted with DELSPRITE, a sprite 
can be recreated with the SPRITE subprogram. 



Examples 

CALL DELSPRITE(#3) deletes sprite 
number 3. 



CALL DELSPRITE(#4 *3*C) deletes 
sprite number 4 and the sprite 
whose number is found by 
multiplying 3 by C. 



MOO CALL DELSPRITE (#3) 



>100 CALL DELSPRITE ( #4, #J*C) 



CALL DELSPRITE(ALL) deletes all 
sprites 



>100 CALL DELSPRITE (ALL) 



74 



TI Extended BASIC 



TI Extended BASIC 



75 



DIM 



DISPLAY 



CHAPTER 



4 



Format 

DIM crray-name{integerl [,integer2] ... [,integer7\ [....]) 
Description 

The DIM statement reserves space in the computer's memory for numeric 
and string arrays. You can dimension an array only once in a program. If ycu 
dimension an array, the DIM statement must appear in the program at a 
lower numbered line than any other reference to the array If you dimension 
more than one array in a single DIM statement, array-names are separated 
by commas. Array-name may be any variable name. A DIM statement may 
not appear in an 1F-THEN-ELSE statement. 

You may have up to seven -dimensional arrays in TI Extended BASIC. The 
number of integers separated by commas following the array name 
determines how many dimensions the array has, The values of the integers 
determine the number of elements in each dimension. 

Space is allocated for an array alter you enter the RUN command but before 
the first statement is executed. Each element in a string array is a null string 
and each element in a numeric array is zero until it is replaced with another 
value. 

The values of the integers determine the maximum value of each subscript 
for that array. If you are using an array not defined in a DIM statement, the 
maximum value of each subscript is 10. The first element is zero unless an 
OPTION BASE statement sets the minimum subscript value to 1 . Thus an 
array defined as DIM A(5) is a one dimensional array with seven elements 
unless the zero subscript is eliminated by the OPTION BASE statement. 



Examples 

DIM XS130) reserves space in the 
computer's memory for 31 members 
of the array called X$. 

DIM DilOO),B(10,9) reserves space in 
the computer's memory for 101 
members of the array called D and 
110 (II times 10) members of th£ 
array called B. 



>100 DIM X$(30) 



>100 DIM D(100),B(10,9) 



Format 

DISPLAY [ [AT(Tow.column)\ [BEEP] [ERASE ALL] [SIZE(numeric- 
expression)) :] variable-list 

Description 

The DISPLAY statement displays information on the screen, Many options 
are available with DISPLAY, making it far more versatile than PRINT. It may 
display data at any screen position, make an audible tone (beep) when 
displaying data, blank screen positions, and erase all characters on trie 
screen before displaying data. 

Options 

AT(rou?.co!umn) places the beginning of the display field at the spec: lied row 
and column Rows are numbered 1 through 24. Columns arc numbered 1 
through 28 with column 1 corresponding with what is called column 3 in the 
VCHAR HCHAR, and GCHAR subprograms. If the AT option is not present, 
data is displayed at row 24. column 1. just as it is with the PRINT statement. 

BEEP sounds a short tone when the data is displayed. 

ERASE ALL fills the entire screen with the blank character before displaying 

data. 

SiZEInumerlc-expression) puts numeric-expressicn blank characters on the 

screen starting at row and column. If the SIZE option is not present, the res: 

of the row at which date is to be displayed is blanked. If numerlc-expressior. 

is larger than the number of positions remaining in the row, only Ihe rest of 

the row is blanked. 



Examples 

DISPLAY AT(5.7):Y displays the 
value of Y at the fifth row, seventh 
column of the screen. 

DISPLAY ERA3E ALL:B puts the 
blank character into all screen 
positions before displaying the value 
of B. 

DISPLAY AT(R,C) SIZE(FIELDLEN) 
BEEF:XS displays the value of XS at 
row R. column C. First it beeps and 
blanks FIELD LEN characters. 



>100 DISPLAY AT(5,7):Y 



>100 DISPLAY ERASE ALL: 3 



>100 DISPLAY ATtR,C) SIZE(FIE 
LDLEN)BEEP:X$ 



76 



TI Extended BASIC 



TI Extended BASIC 



77 



DISPLAY 



Program 

The program at the right illustrates a 
use ot DISPLAY. It allows you to 
position blocks at any screen position 
to draw a figure or design. 



>100 CALL CLEAR 

>110 CALL COLOR i 9, 5, 5) 

>120 DISPLAY AT(23,1): "ENTER 

ROW AND COLUMN." 
>130 DISPLAY AT (24,1): "ROW: 

COLUMN:" 
>140 FOR C0UNT=1 TO 2 
>150 CALL KEY(0,ROV(C0UNT),S) 
>160 IF S<=0 THEN 150 
>170 DISPLAY AT(24,5+C0UNT)SI 

ZE(1) :STR$(R0W(C0UNT)-48) 
>180 NEXT COUNT 
>190 FOR C0UNT=1 TO 2 
>200 CALL KEY(0,COLUMN(COUNT) 

,S) 
>210 IF 3<=0 THEN 200 
>220 DISPLAY AT(2<4,16+C0UNT)S 

IZE(l):STR$(C0L'JMN(C0UNT)-48 

) 
>230 NEXT COUNT 
>240 R0W1=10*(R0V(1M8HR0W( 

2)-48 

>250 COLUMNl=10*;COLUMN(L)-48 

)+C0LUMN(2)-48 
>260 DISPLAY AT(ROWl,C0LUMNl) 

SIZE(1):CHR$(96; 
>270 GOTO 130 

(Press SHIFT C to stop the 

program.) 



Display using 



CHAPTER 



4 



Format 

DISPLAY [option-list:] USING string-expression [: variable-list] 
DISPLAY [option-list:] USING Une-number [: variable-list] 

Description 

the DISPLAY. ..USING statement is the same as DISPLAY with the addition 
of the USING clause, which specifies the format of the data in variable-list. If 
String-expression is present, it defines the format. If line-number is present, 
H refers to the line number of an IMAGE statement See IMAGE for an 
explanation of how the format is defined. 

Examples 

DISPLAY AT(10,4):USING "## #*":N 
displays the value of N at the tenth 
row and fourth column, with the 
format *•####". 



>100 DISPLAY AT(13,4):USING 



DISPLAY USING "##. ##":N displays 
the value of N at the 24th row and 
first co:umn, with the format 



>100 DISPLAY USING "M.##-:N 



78 



TI Extended BASIC 



Tl Extended BASIC 



79 



DISTANCE subprogram 



Format 

CALL DIST ANCE{#sprite-nurnber#sprite-nurnb?r,nurnertc-variable) 
CALL DIST ANCElxspr-ite-number. dot-row ,dot-column,numeric-vcriable) 

Description 

The DISTANCE subprogram returns the square of the distance between two 
sprites or between a sprite and a location. The position of each sprite is 
considered to be its upper left hand corner. Dot-row and dot-colurnn are from 
1 to 256. The squared distance is returned in numeric-variable. 

The number returned is computed as fallows: The difference between the 
dot-rows of the sprites (or the sprite and the location) is found and squared, 
Then the difference between the dot-columns of the sprites (or the sprite and 
the location) is found and squared. Then the two squares are added. If the 
sum is larger than 32767. then 32767 is returned. The distance between the 
sprites (or the sprite and the location) is the square root of the value 
returned. 



Examples 

CALL DISTANCE(#3.*4,DIST) sets 
DIST equal to the square of the 
distance between the upper left hand 
corners of sprite # 3 and sprite #4. 

CALL DISTANCE(*4,13.89,D) sets D 
equal to the square of the distance 
between the upper left hand coiner 
of sprite #4 and position 18, 89, 



>100 CALL DISTANCE^, #4, DIST) 



>100 CALL DISTA.VCE(K,1S,89,D) 




CHAPTER 



4 



format 

END 
Description 

The END statement ends your program and may be used interchangeably 
udth the STOP statement. Although the END statement may appear 
anywhere, it is normally placed a, the last line in a program and thus ends 
*e program both physically and logically. The STOP statement is usually 
used in other places that you want your program to halt. In TI Extended 
BASIC vou are not required to use the END statement. The program 
automatically stops after it executes the highest numbered l.ne. 



80 



TI Extended BASIC 



H Extended BASIC 



81 



EOF 



Format 

EOFtfile-number) 

Description 

The EOF function is used to test whether there is another record to be read 
from a file. The value of file-number indicates the file to be tested and must 
correspond to the number of an open file. The EOF function cannot be used 
with cassettes. 

The EOF function always assumes that the next record is going to be read 
sequentially, even if you are using a RELATIVE file. 

The value that the EOF function provides depends on where you are in the 
file. If you are not at the last record of the file, the function returns a value of 
0. If you are at (he last record of ihe file, the function returns a value of 1 If 
the diskette or other storage medium is full, you are at the end of the file 
and there is no more room for any data, the function returns a value of - 1. 
For more information, see the Disk Memory System manual. 
Examples 

PRINT EOF(3) prints a value >100 PRINT EOF (3) 

according to whether you are at the 
end of the file that was opened as #3, 

IF EOF(27)< >0 THEN 1 150 transfers 
control to line 1150 if you are at the 
end of the file that was opened as 
*27. 



>100 IF EOF(27)<>0 THEN 1150 



IF EOF(27) THEN 1 150 transfers 
control to line 1 150 if you are at the 
end of the file that was opened as 
*27. 



>100 IF E0F{27) THEN 1150 



82 



T[ Extended BASIC 



ERR subprogram 



CHAPTER 



4 



Format 

CALL ERR(error-code,error-rype [.error-severity Mne-number\ ) 

Description 

The ERR subprogram returns the errorcode and error-type of the most 
recent uncleared error. An error is cleared when it has been accessed by the 
ERR subprogram, another error has occured. or the program has ended. 

Error-codes are two or three digit numbers. The meanings of each of the 
codes is in Appendix N. 

If error-type is a negative number, then the error was in the execution of the 
program. If the error-code is 130 {HO ERROR), the error-type is a posiiive 
number and the number is the number of the file that caused the error. 

If no error has occured. CALL ERR returns all values as zeros. 

CALL ERR is used in conjunction with ON ERROR. 

Options 

You may optionally obtain the error-severity and fine-number on which the 
error occured. The error-seueriry is always 9. The line-number is the number 
of the line being executed when the error occurred. It is not always the line 
that is the source of the problem since an error may occur because of values 
generated or actions taken elsewhere in a program. 

Examples 

CALL ERR(A.B) sets A equal to the 
error-code and B equal to the error- 
type of the most recent error. 

CALL ERR(W,X,Y,Z) sets W equal to 
the error-code, X equal to the error- 
type, Y equal to the error severity, 
and Z equal to trie (ine-number of 
the most recent error. 



>100 CALL ERR(A,B) 



>100 CALL ERR(W,X,Y,z; 



I 



TI Extended BASIC 



83 



ERR SUBPROGRAM 



Program 

The program on the right illustrates 
the use of CALL ERR. An error is 
caused in line 110 by calling for an 
illegal screen color. Because of line 
100. control is transferee! to line 130. 
Line 140 prints the values obtained. 
The 79 indicates that a bad value 
was provided. 

The - 1 indicates that the error was 
in a statement. The 9 is the error- 
severity. The 110 indicates that the 
error oecured in line 110. 



>100 CW ERROR 130 

>110 CALL SCREEN (18) 

>120 STOP 

>130 CALL ERR(J,X,Y,Z) 

>l40 PRINT WjX;Y;Z 

>RUN 

> 79 -1 9 1L0 



84 



TI Extended BASIC 



1 



EXP 



CHAPTER 



4 



Format 

EXP [numeric-express ion) 



Description 

The EXP function returns the exponential value le*) of numeric express ion. 
The value of e is 2.718281828459. 



Examples 

Y = EXP(7) assigns to Y Lhe value of e 
raised to the seventh power which is 
1096.633158429. 

L = EXP(4.394S60467) assigns to L 
the value of e raised to the 
4.394960467 power which is 
81.04142688868. 



>100 Y=EXP(7) 



>100 L=EXP( 4. 394960467) 



Tl Extended BASIC 



85 



FOR TO [STEP] 



-1 



Format 

FOR control-variable = initial-value TO limit [STEP increment] 

Description 

The FOR-TO-STEP statement repeats execution of the statements between 
FOR-TO-STEP and NEXT until the control-variable is outside the range of 
initial-value to limit. The FOR-TO-STEP statement is useful when repeating 
the same steps in a loop. The FOR-TO-STEP statement cannot be used in an 
IF-THEN-ELSE statement. 

Control-variable may be any unsubscripted numeric variable. It acts as a 
counter for the loop. Inilial-value and limit are numeric expressions. The 
loop starts with control-variable given a value of initial-vaiue . The second 
time through the loop, the value of control-variable is changed by one or 
optionally by increment, which may be a positive or negative number. This 
continues until the value of control-variable is outside the range initial-value 
to limit. Then the statement after NEXT is executed. The value of control- 
variable is not changed when the computer leaves the loop. 

The value of control-variable can be changed within the loop, but this must 
be done carefully to avoid unexpected results. Loops may be "nested," that 
is one loop may be contained wholly within another. You may leave a loop 
using GOTO, GOSUB. IF-THEN-ELSE, or the like, and then return. However, 
you may not enter a FOR-NEXT loop at any point except at its start 

If initial-value exceeds limit at the beginning of the FOR-NEXT loop, none of 
the statements in the loop are executed. Instead execution continues with the 
first statement after the NEXT statement. 



Examples 

FOR A=1TO5 STEP 2 executes the 
statements between this FOR and 
NEXT A three times, with A having 
values of 1, 3, and 5, After the loop is 
finished, A has a value of 7. 

FOR J = 7 TO -5 STEP -.5 executes 
the statements between this FOR 
and NEXT J 25 times, with J having 

values of 7, 6.5, 6 -4, -4.5, and 

-5. After the loop is finished, J has 
a value of -5.5. 



MOO FOR A=l TO 5 STEP 2 



MOO FOR J=7 TO -5 STEP -.5 



86 



TI Extended BASIC 



FOR TO [STEP] 



program 

The program at the right illustrates a 
use of the FOR-TO-STEP statement. 
There are three FOR-NEXT loops, 
with control-variables of CHAR, 
'ROW. and COLUMN, 



CHAPTER 



4 



MOO CALL CLEAR 

>110 D^O 

>120 FOR CHAR-33 TO 63 STiP 3 


>130 FOR R0W=1+D TO 21+D STEP 

4 
>l40 FOR C0LUMN=1-D TO 29+D S 

TEP 4 
M50 CALL VCHAR (ROW, COLUMN, CH 

AR) 
>160 NEXT COLUMN 
>170 NEXT ROW 
>180 D=2 
M9-0 NEXT CHAR 
>200 GOTO 200 

(Press SHIFT C to stop the 

program. ] 



TE Extended BASIC 



87 



GCHAR subprogram 



Format 

CALL GCHAR(row .column, numeric- variable) 
Description 

The GCHAR subprogram reads a character from anywhere on the display 
screen. The computer returns in numeric-variable the ASCII code for the 
character in the position described by row and column. 

Row and column are numeric expressions. A value of 1 for row indicates the 
top of the screen. A value of I for the column indicates the left side of the 
screen. The screen can be thought of as a grid as shown below. 

COLUMNS 

2 4 H 10 12 14 16 18 20 22 24 26 2H 30 32 
( 1 * -M * * 7 \ g 1 11 | 13 \ 15 i 17 I 1Q \ 21 J 23 I 25 I 27 I 20 I 31 I 
1 
2 

3 
4-^ 

5 

(i — 

7 
8 — 

o 

W 13 

s 14 ^ 

15 

If)— 

17 

18— 

15 
20 — 

21 
22 — 

2? 
24^ 



. 

— — - — ■ — ' — ■ -■ . 1- , . , _ 

. 

— ■ — — ■ __ _ , i 

" — — — .— , — _^_ — __ — , — . — , , M , . __ , 

" " 

, 



Examples 

CALL GCHAR(12,16,X| assigns to X 
the ASCII code of the character that 
is in row 12, column 16. 

CALLGCHAR;R.C,K) puts into X the 
ASCII code of the character that is in 
row R. column C 



>100 CALL GCHAR( 12,16,X) 
>100 CALL GCHAR(R,C,K) 



88 



GOSUB 



CHAPTER 



4 



Format 

GOSUB line-number 
GO SUB line-number 

Description 

The GOSUB statement allows transfer to a subrouti ne. When executed, 
control is transferred to line-number and that statement and any following 

; (which may include any statements, including GOTO statements and other 
GOSUB statements) are executed. When a RETURN statement is 
encountered, control is returned to the next statement following the GOSUB 
statement. Subroutines are most useful when the same action is to be 

; performed in different parts of a program See also ON. ..GOSUB. Subroutines 

i in Tl Extended BASIC may call themselves. 



TI Extended BASIC 



Example 

GOSUB 200 transfers control to 
statement 200. That statement and 
the ones up to RETURN are 
executed, and then control returns to 
the statement after the calling 
statement. 



>100 GOSUB 200 



TI Extended BAS.C 



89 



GOSUB 



Program 

The program on the right illustrates 
a use of GOSUB. The subroutine at 
line 260 figures the factorial of the 
value of NUMB. The whole program 
figures the solution to the equation 



NUMB = 



X! 



Y! * (K-Y)l 

where Lhe exclamation point means 
factorial. This formula is used to 
figure certain probabilities. For 
instance, if you enter X as 52 and Y 
as 5. you'll find the number of 
possible five card poker hands, 



>100 CALL CLEAR 

>110 INPUT -ENTER X AND Y: ": 

X,Y 

>120 IF X<Y THEN 110 
>130 IF X>69 OR Y>69 THEN 110 
>140 NUMB=X 
>150 GOSUB 260 
>160 NUMERAT0R=NUMB 
>170 NUMB=Y 
>180 GOSUB 260 
>190 DEN0MINATOR=NUMB 
>200 NUMB=X-Y 
>210 GOSUB 260 
>220 DEN0MINAT0R=DENOMINATOR* 

NUMB 
>230 NUME=NUMERA?0R/DEN0MINAT 

OR 

>240 PRIM ■NUMBER IS"; NUMB 
>250 STOP 

>260 REM FIGURE FACTORIAL 
>270 IF NUMB<0 THEN PRIM "NE 

NATIVE" : : GOTO 110 
>280 IF MUMB<2 THEN NUMB=1 :: 

GOTO 330 
>290 MULT>NUMB-1 
>300 NUMB=NUMB*MULT 
>310 MULT=MULT-1 
>320 IF MULT>1 THEN 300 
>330 RETURN 



90 



Tl Extended BASIC 



iOTO 



CHAPTER 



4 



tat 

)TO line-number 
I TO line-number 

icrlption 

ie GOTO statement allows you to transfer control unconditionally to 
lother line within a program. When a GOTO statement is executed, control 
, passed to the first statement on the line specified by line-number. 

ie GOTO statement should not be used to transfer control into 
lbprograms. 



rogram 

the program at the right shows the 
of GOTO in line 160. Anytime 
it line is reached the program 
tecutes iine 130 next and proceeds 
torn that new point. 



>100 REM ADD 1 THROUGH 100 
>110 ANSWER=0 
>120 NUMB=1 

>lj0 ANSWER=ANSVERfNUMB 
>l40 NUMB-MUMB+1 
>150 IF NUMB>100 TrlEN 170 
>160 GOTO 130 

>170 PRINT "THE ANSWER IS"; AN 
SVER 
>RUN 
THE ANSWER IS 5050 



Tl Extended BASIC 



91 



HCHAR subprogram 



Format 

CALL HCUAR{rowxolumn. character-code [.repetition] ) 

Description 

The HCHAR subprogram displays a character anywhere on the display 
screen and optionally repeats it horizontally. The character with the ASCII 
value of character-code is placed in the position described by row and 
column and :s repeated horizontally repetition times. 

A value of 1 for rou> indicates the top of the screen. A value of 24 is the 
bottom of the screen. A value of 1 for column indicates the left side of the 
screen. A value of 32 is the right side of the screen. The screen can be 
thought of as a grid as shown below. 

COLUMNS 





1 


2 

i 


3 


4 


5 


ft 


7 


8 
I 


U 


10 

1 


11 


\2 
\ 


13 


14 

1 


15 


lfi 
1 


17 


IS 
t 


19 


20 
1 


2\ 


22 


23 


24 


25 


2b 
\ 


27 


28 
\ 


29 


3D 
1 


3t 


32 
1 


1 


































































2 — 


































































3 


































































4^ 


































































5 


































































ft — 


































































7 


































































8 — 


































































y 


































































R i<> — 


































































O u 

,17 l2 ~~ 


































































































































w 13 


































































S 14* 


































































\5 


































































10 — 


































































17 


































































18 — 


































































19 


































































211 — 


































































21 


































































22 — 


































































23 


































































24^ 



































































92 



TI Extended BASIC 




CHAR SUBPROGRAM 



CHAPTER 



4 



Samples 

IcALL HCHAR( 12. 16.33) places 
^'Character 33 tar exclamation point) 
lin row 12. column 16. 

S 

|CALL HCHAR(1.LASC("! -).768) 

places an exclamation point in row 

Si, column 1. and repeats it 768 

ies, which fills the screen. 

,L HCHAR(R.CK.T) places the 
iracter with zn ASCII code 
jecified by the value of K in row R, 
Column C and repeats it T times. 



XLOO CALL HCHAR (:2, 16,33) 



XLOO CALL HCHARCUl^SCt'-!'-). 
768) 



XLOO CALL HCHAR(R,C,K/ 



Tl Extended BASIC 



93 



IF THEN [ELSE] 



Format 

IF relational-expression THEN line-number 1 [ELSE Une-number2] 
IF relational-expression THEN statement 1 [ELSE statement] 
IF numeric-expression THEN line-number 1 [ELSE iine-numfc>er2] 
IF numertc-expression THEN statement J [ELSE statement2] 

Description 

The IF-THEN-ELSE statement allows you to transfer control to line-number 1 
or to perform statement 1 if relational-expression is true or if numeric- 
expression is not equal to zero. Otherwise control passes to the next 
statement, or optionally to line-number2 or stctement2. 

Statement 1 and statement2 may each be several statements long, separated 
by the statement separator symbol. They are only executed if the clause 
immediately before them is executed. The IF-THEN-ELSE statement cannot 
contain DATA, DEF, DIM. FOR, NEXT. OPTION BASE. SUB, or SUBEND. 



Examples 

IF X>5 THEN GOSUB 300 ELSE 
X =X + 5 operates as follows: If X is 
greater than 5, then GOSUB 300 is 
executed. When the subroutine is 
ended, control returns to the Une 
following this line. If X is 5 or less. X 
is set equal to X + 5 and control 
passes to the next line. 

IF 9 THEN C = C+l::GOTO 
500::ELSE L = L/C::GOTO 300 
operates as follows: If Q is not zero, 
then C is set equal to C + 1 and 
control is transferred to line 500. If Q 
is zero, then L is set equal to L/C and 
control is transferred to line 300. 

IF A >3 THEN 300 ELSE A = 0:: 
GOTO 10 operates as follows: If A is 
greater than 3, then control is 
transferred to line 300. Otherwise, A 
is reset to zero and control is 
transferred to line 10. 



>I00 IF X>5 THEN GOSUB 300 EL 
SE X=X+5 



>100 IF Q THEM C=C+1::G0T0 50 
0::ELSE L=L/3::G0T0 300 



>100 IF A>3 THEN 300 ELSE A=0 
: :G0"0 10 



94 



TI Extended BASIC 



THEN [ELSE] 



CHAPTER 



4 



'A$ = "Y" THEN COUNT = 
)UNT+ 1::DISPLAY AT(24,1); 
"HERE WE GO AGAIN!"::GOTO 300 
erates as follows: If AS is not equal 
"Y*\ then coritrol passes to the 
ext line. If A$ is equal to "Y'\ then 
)UNT is incremented by 1 , a 
jessage is displayed, and control is 
isferred to line 300, 

HOURS<=40THEN 
AY = HOURS* WAGE ELSE 
AY = HOURS* WAGE + .5* WAG- 
•(HOURS-40) :: OT= 1 operates as 

follows: If HOURS is less than or 
[ual to 40. then PAY is set equal to 
[OURS* WAGE and control passes to 
ie next line. If HOURS is greater 

|han 40 then PAY is set equal to 
[OURS'WAGEf 5*WAGE*(HO- 

URS-40), OT is set equal to 1, and 

control passes to the next. line. 

kFA=lTHEN IF B = 2 THEN C = 3 
fcLSE D = 4 ELSE E = 5 operates as 
follows: If A is not equal :o 1 , then E 
js set equal to 5 and control passes to 
the next line. If A is equal to 1 and B 
Is not equal to 2 then D is set equal 
to 4 and control passes to the next 
Jine. If A is equal to 1 and B is equal 
to 2, then C is set equal to 3 and 
control passes tc: the ncx: line. 



>100 IF A$="Y" THEN C0UNr=C0U 
NT+1:: DISPLAY A7(24,l): "HERE 
WE GO AGAIN!":: GOTO 300 



>100 IF HOURS<=40 THEN PAY=H0 
LIRS*VAGE ELSE P^Y=H0URS*WAGE 
f.5*WAGE*(HOURS-40) :: 0T=1 



>100 IF A-l THEN IF B=2 THEN 
3=3 ELSE D=A ELSE E=5 



TI Extended BASIC 



95 



IF THEN [ELSE] 



IMAGE 



CHAPTER 



4 



Program 

The program on the right illustrates 
a use of 1F-THEN-ELSE. It accepts up 
to 1000 numbers and then prints 
them in order from smallest to 
largest. 



>100 CALL CLEAR 

>I10 DIM VALIE(IOOO) 

>120 PRINT "ENTER VALUES TO B 

E SORTED. ":"ENTER 'S999' TO 

END ENTRY." 
>130 FOR C0UNT=1 TO 1000 
>140 INPUT VALUE(COUNT) 
>150 IF VALUE (COUNT) =9999 THE 

N 170 
>160 NEXT COl'NT 
>170 C0UNT=C0UNT-1 
>180 PRINT "SORTING."' 
>190 FOR S0RT1=1 TO COUNT-1 
>200 FOR S0RT2=S0RT1+1 TO COU 

NT 
>210 IF VALUE(SORT1)>VALUE(SO 

RT2)THEN TEW^VALUEfSQRTl) : : 
VALUE (S0RTl)=VALUE(S0RT2) : : 
VALUE (S0RT2}=TEMP 
>220 NEXT S0RT2 
>230 NEXT S0F.T1 
>240 FOR S0RTED=1 TO COUNT 
>250 PRINT VALUE (SORTED) 
>260 NEXT SORTED 



[Format 

MjA AGE format-string 

| Description 

f The IMAGE statement specifies the format in which numbers are printed or 
' displayed when the USING clause is present in PRINT or DISPLAY. No action 
js taken when the IMAGE statement is encountered during program 
execution. The IMAGE statement must be the only statement on a line. The 
following description of format-string also applies to the use of an explicit 
image after the USING clause in PRINT.. .USING and DISPLAY.. .USING. 

Format-string must contain 254 or fewer characters and may be made up of 
any characters. They are treated as follows: 

, Pound signs (^Jare replaced by the print-list values given in PRINT, .USING 
or DISPLAY... USING. One pound sign must be allowed for each digit of the 
value and one for the negative sign if it is present, or for each character that 
Is to be printed If there is not enough rocm to print the number or 
characters in the space allowed, each pound sign Is replaced with an asterisk 
(*). If more numbers are after the decimal place than are allowed by the 
number of pound signs after the decimal place in the IMAGE statement, the 
number is rounded to fit. If there are fewer non- numeric characters than are 
allowed for in the print siring, the value printed will have blanks for the 
extra characters. 

To indicate tha: a number is to be given in scientific notation, circumflexes 
(A) must be given for the E and power numbers. There must be four or five 
circumflexes, and 10 or fewer characters (minus sign, pound signs, and 
decimal point) vhen using the E format. 

The decimal point separates the whole and fractional portions of numbers. 
and is printed where it appears in the IMAGE statement. 

All other letters, numbers, and characters are printed exactly as they appear 
in the IMAGE statement. 

Format-string may be enclosed in quotation marks. If it is not enclosed in 
quotation marks, leading and trailing spaces are ignored. However, when 
used directly in PRINT.. .USING or DISPLAY... USING, it must be enclosed in 
quotaton marks. 

Each IMAGE statement may have space for many images, separated by any 
character except a decimal point. If more values are given n the 
PRINT... USING or DISPLAY... USING statement than there are images, then 
the images are reused, starting at the beginning of the statement. 

If you wish, you may put format-string directly in the PRINT. ..USING or 
DlSPLAY-.-USI^G statement immediately following USING. However, if a 



96 



Tl Extended BASIC 



TT Extended BASIC 



97 



>100 IMAGE %WM.m 
>110 PRINT USING 10O:A 



IMAGE 



format-string is used often, it is more efficient to refer to an IMAGE 

statement 

Examples 

IMAGE $###*### allows printing of 

any number from - 999.999 to 

9999.999. The following show how 

some sample values will be printed 

or displayed. 

Value Appearance 

- 999 999 $ - 999.999 
-34.5 $ -34.500 
$ 0.000 
12.4565 $ 12.457 
6312.9991 $6312,999 
99999999 $ ******** 

IMAGE THE ANSWERS ARE #*# 
AND ##. ## allows printing of two 
numbers. The first may be from - 99 
to 999 and the second may be from 
-9.99 to 99.99. The following show 
how some sample values will be 
printed or displayed. 

Values Appearance 

- 99 - 9.99 THE ANSWERS 

ARE - 99 AND 

-9.99 
-7 -3.459 THE ANSWERS 

ARE - 7 AND 

-3,46 
THE ANSWERS 

ARE AND .00 
14.8 12.75 THE ANSWERS 

ARE 15 AND 12.75 
795 852 THE ANSWERS 

ARE 795 AND 



>200 IMAGE THE ANSWERS ARE # 

U AND MM 
>210 PRINT USING 200: A, B 



-984 64,7 



THE ANSWERS 
ARE *** AND 

64.70 



[image 



I IMAGE DEAR #### allows printing 
|. a four-character string. The following 

show how some sample values will 

be printed or displayed. 



CHAPTER 



Values 

JOHN 

TOM 

RALPH 



Appearance 

DEAR JOHN, 
DEAR TOM , 
DEAR * * * * . 



Programs 

The program on the right illustrates 
a use of IMAGE It reads and prints 
seven numbers and their total. Lines 
110 and 120 se' up the images. They 
are the same except for the dollar 
sign in line 1 10. To keep the blank 
space where the dollar sign was, the 
format-string ir line 120 is enclosed 
In quotation marks. 

Line 180 prints the values using the 
IMAGE statements. 



Line 210 shows that the format can 

be put directly in the PRINT... USING 

statement. 

The amounts are printed with the 

decimal points lined up. 



4 



>300 IMAGE DEAR MM , 
>310 PRINT USING 300 :X$ 



MOO CALL CLEAR 
>110 IMAGE %MMM 
>120 IMAGE " Mm.M" 
>130 DATA 233-45,-147.95,8.4, 
37.263,-51.299,35.2,464 
>l40 TOTAL=0 
>150 FOR A=l TO 7 
>160 READ AMOUNT 
>170 TOTAL- TOT ALf AMOUNT 

>180 IF A=l THEN PRINT USING 
110: AMOUNT ELSE PRINT USING 
120: AMOUNT 
>190 NEXT A 

>200 PRINT " - " 

>210 PRINT USING <%MMM'-\T: 
OTAL 
>RUN 

% 233-45 

-147.95 

8.40 

37.26 

-51.30 

85.20 

464.00 



% 629.06 



98 



Tl Extended BASIC 



TI Extended BASIC 



99 



IMAGE 



The program at the right shows the 
effect of using more values in the 
PRINT. ..USING statement than there 
are images in ihe IMAGE statement. 



>100 IMAGE UM.MJM.t 

>110 PRINT USING 100: 50. 34i 50 

.34,37.26,37.26 
>RUN 

50.3^, 50.3 

37.26, 37.3 



100 



TI Extended BASIC 



INIT subprogram 



CHAPTER 



4 



? Format 
CALL INIT 

Description 

The INIT subprogram is used, along with LINK, LOAD, and PEEK, tu access 
assembly language subprograms. The INIT subprogram checks to see that 
the Memory Expansion is connected, prepares the computer to run assembly 
language programs, and loads a set of supporting routines into the Memory 
Expansion. 

The INIT subprogram must be called before LOAD and LINK are called. INIT 
removes any previously loaded subprograms from the Memory Expansion. 
The effects of INIT last until the Memory Expansion is turned off and does 
not need to be -ailed from each program that is using the subprogram 
involved. 

If the Memory Expansion is not attached, a syntax error is given. 



K 



TI Extended BASK.' 



101 



INPUT 



Format 

INPUT \input-prompt:\ variable-list 

(For information on using the INPUT statement wth a file, see INPLT with 

files.) 

Description 

This form of the INPUT statement is used when entering data from the 
keyboard. The INPUT statement suspends program execution until data is 
entered from the keyboard. The optional input-prompt may display on the 
screen what data is expected. 

Variable-list contains the variables (scalar or array elements; numeric or 
string) which are assigned values when the INPUT statement is executed. 
The variables are separated by commas. If a value in variable-list \s input, it 
may later be used as a subscript in the same INPUT statement. 

When inputting string values, they may optionally be enclosed in quotation 
marks. However, if you wish to have leading or trailing blanks or ccmmas, 
the entire string must be enclosed in quotation marks. If more than one 
value is to be input, separate the values lo be input by commas. 

Options 

The optional input-prompt is a string expression. It must be followed by a 
colon. It is displayed on the screen when the INPUT statement is executed. If 
there is no input-prompt, a question mark and space are displayed to 
indicate that input is expected, [f there is an input-prompt, it takes the place 
of the question mark and space 



Examples 

INPUT X allows the input of a 

number. 

INPUT X$,Y allows the input of a 
string and a number. 

INPUT "ENTER TWO NUMBERS: 
":A,B prints the prompt ENTER 
TWO NUMBERS and then allows the 
entry of two numbers. 

INPUT A(J),J first evaluates the 
subscript of A and then accepts data 
into that subscript of A. Then a value 
is accepted into J, 



>100 INPUT X 

>100 INPUT X$,Y 

>100 INPUT "ENTER TWO NUMBERS 
":A,B 

>100 INPUT A(J),J 



CHAPTER 



INPUT 



INPUT J.A(J) first accepts data into J 
Hid then accepts data into ;he Jth 
| element cf the array A. 

I' program 

I The prog-am on the right illustrates 
| * use of IMPUT from the keyboard. 

Lines 110 through 140 allow the 
[ person using the program to enter 
data, as requested with the input- 
'?;■ prompts. 



Lines 170 through 250 construct a 
letter based on the input- 



102 



TI Extended BASIC 



4 



>100 INPUT J,A<J) 



>100 CALL CLEAR 

>110 INPUT 'ENTER YOUR FIRST 

NAME: ":FNAME$ 
>120 INPUT "ENTER YOUR LAST N 

AME: ":LNANE$ 
>130 INPUT "'ENTER A THREE DIG 

IT NUMBER: "; DOLLARS 
>1A0 INPUT "ENTER A T\J0 DIGIT 

NUMBER: ": CENTS 
>15D IMAGE OF $#MM JVKD TU 

T IF YOU 
>16Q CALL C1EAR 
>17D PRINT "DEAR ■ , ;FNAME$;", " 

>180 PRINT " THIS IS TC R 

EMIND YOU" 
>190 PRINT "THAT YOU OWE US T 

HE AMOUNT" 
>200 PRINT USING 150; DOLLARS* 

CENTS/100 
>210 PRINT "DO NOT PAY US, YO 

U WILL SOCN" 
>220 PRINT "RECEIVE A LETTER 

FF.0M OUR" 
>2j0 PRINT "ATTORNEY, ADDRESS 

ED TO" 
>240 PRINT FNAKE$;" 'jLNAME$; 

"!": : 
>250 PRINT TAB(15)rSINCERELY 

,": : :TAE(15);"I. DUN YOL": 

>260 GOTO 260 
(Press SHIFT C to stop the 
program,) 



TI Extended BASIC 



103 



INPUT (with files) 



Format 

INPUT # file-number [,REC record-number] -.variable-list 

(For information on using the INPUT statement tc enter data from the 
key beard, see INPUT J 

Description 

The INPUT statement, when used with files, allows you to read data from 
files. The INPUT statement can only be used with files opened in INPUT or 
UPDATE mode. DISPLAY files may not have over 160 characters in each 
record. 

File-number and variable-list mast be included in the INPUT statement. 
Record-number may optionally be included when reading random access 
(RELATIVE) files from diskettes. 

All statements which refer to files do so with a file-number from through 
255. File-number is assigned to a particular file by the OPEN statement. File 
number is dedicated to the keyboard and screen of the computer. It cannot 
be used for other files and is always open, File-number is entered as a 
number sign (#) followed by a numeric expression that, when rounded to the 
nearest integer, is a number from Oto255, and is the number of a file that is 
open. 

Variable-list is the list of variables into which you want the data from the file 
to be placed. It consists of string or numeric variables separated by commas 
with an optional trailing comma. 

Options 

You can optionally specify the number of the record that you want lo read as 
record- number. It can only be specified fcr diskette files which have been 
opened as RELATIVE. The first record of a Tile is number 0. 



104 



Tl Extended BASIC 



INPUT (with files) 



CHAPTER 



4 



Examples 

INPUT *1:X$ puts into XS the next 
value available in the file that was 
opened as #1. 

INPUT *23:X,A,LL$ puts into X. A. 
and LLS the next three values from 
the file :hat was opened as *23. 

INPUT #1 l.REC 44:TAX puts into 
TAX the first va!ue of record number 
44 of the file that was opened as *1 1. 

INPUT #3:A,B f C puts into A. B, and 
C the next three values from the file 
that was opened as *3. The comma 
after C creates a pending input 
condition. When the next INPUT or 
LINPUT statement using this file is 
performed, one of the following 
actions occurs: If the next INPUT or 
LINPUT statement has no REC 
clause, the computer uses the data 
beginning where the previous INPUT 
statement stopped. If the next INPUT 
or LINPUT statement includes a REC 
clause, the computer terminates the 
pending input condition and reads 
the specified record. 



>100 INPUT #1:X$ 



MOO INPUT #23:X,A,LL$ 



>L00 INPUT #11, REC 44: TAX 



>100 INPUT #3:A,E,C, 



TI Extended BASK.' 



105 



INPUT (with files) 



Program 

The program at the right illustrates a 
use of the INPUT statement. It opens 
a file on the cassette recorder and 
writes 5 records on the file. It then 
goes back and reads the records and 
displays them on the screen. 



>100 CPEN #1:"CS1", SEQUENTIAL 
, INTERNAL, OUTPUT, FIXED 64 

>110 FOR A=l TO 5 

>120 PRINT #1:"THIS IS RECORD 
"A 

XUO NEXT A 

>1A0 CLOSE #1 

>150 CALL CLEAR 

>160 OPEN #1:"CS1", SEQUENTIAL 
, INTERNAL, INPUT, FIXED 64 

>170 FDR B=l TO 5 

>180 IMPUT #1:A$,C 

>190 DISPLAY AT(B,l):A$;C 

>200 NSXT B 

>210 CLOSE #1 

>RUN 

* REWIND CASSETTE TAPE CS1 
THEN PRESS ENTER 

* PRESS CASSETTE RECORD CS1 
THEN PRESS ENTER 

* PRESS CASSETTE STOP CS1 
THEN PRESS ENTER 

* REWIND CASSETTE TAPE CS1 
THEN PRESS ENTER 

* PRESS CASSETTE PLAY CSl 
THEN PRESS ENTER 

THIS IS RECORD 1 
THIS IS RECORD 2 
THIS IS RECORD 3 
THIS IS RECORD 4 
THIS IS RECORD 5 

* PRE£S CASSETTE STOP CSl 
THEN PRESS ENTER 




CHAPTER 



4 



format 

Urrinumertc-expression) 

Description 

The INT function returns the greatest integer less than or equal to numeric- 
expression. 



Exunp^s 

PRINT INT(3.4) prints 3. 

X = INT(3.9) sets X equal to 3. 

psINT(3. 9999999999) sets P equal 
to 3. 

DISPLAY AT(3.7):INT(4.0) displays 4 
at the third row, seventh col u ma. 

N = INT( - 3.9) sets N equal to - 4. 
K = INT( -3 .OOOOOOl) sets K equal to 
-4. 



>100 PRINT INTO. 4) 

>100 X=INT(3*90) 

>100 P= ENT (3*9999999999) 

>100 DISPLAY A7(3,7):INT(4.0) 

>100 N=INT(-3.9) 

>100 K=INT(-3.C000001) 



See the Disk Memory System manual tor instrucions on using diskettes. 



106 



TI Extended I J ASIC 



TI Extended BASIC 



107 



JOYST subprogram 



Format 

CALL JO YST(/cey- unit, x-ret urn, y- re turn] 

Description 

The JOYST subprogram returns data into x return and y return based on the 
position of the joystick in the Wired Remote Controller (available 
separately} labeled key-unit. Key-unit Is a numeric expression with a value of 
1 through 4. The values 1 and 2 are joysticks 1 and 2. Values 3 and 4 are- 
reserved for possible future use. 

The values returned in x-return and y-return depend on the position of the 
joystick. The values returned are shown below. The first value in the 
parentheses is placed in ^-return. The second value is placed in y-return 



(0.4) 



(4,4) 



(-4,0) 



(-4,-4} 



Example 

CALL JOYST(IX.Y) returns values 
in X and Y according to the position 
of joystick number 1. 

Program 

The program on the right illustrates 
a use of the JOYST subprogram. It 
creates a sprite and then moves it 
around according to the input from a 
joystick. 




(4,0) 



(4.-4) 



>100 CALL J0YST(1,X,Y) 



>100 CALL CLEAR 

>110 CALI SPRITE(#1 J 33, 5,96,1 

28) 
>120 CALI J0YST(1,X,Y) 
>130 CALL M0TI0N(#1,-Y,X] 
>K0 GOTO 120 

(Press SHIFT C to stop the 

program.) 



KEY subprogram 



CHAPTER 



4 



Format 

CALL KEY {key-unit. return-variable. status-variable] 

Description 

The KEY subprogram assigns the code of the key pressed to return-variable. 
The value assigned depends on Lhe key-unit specified. If key-unit is O t input 
is taken from the entire keyboard, and the value placed in return-variable is 
the ASCII code of the key pressed, If no key is pressed, return-variable is set 
equal to - 1 . Sse Appendix C for a list of the ASCII codes. 
If key unit is 1. input is taken from the left side of the keyDoard. If key unit is 
2. input is taken from the right =ide of the keyboard. The possible values 
placed in return-variable are given in Appendix J. Values of 3, 4. and 5 are 
reserved for possible future uses. 

Status-variable indicates whether a key has been pressed A value of 1 
means a new key was pressed since the last CALL KEY was executed. A 
value of - 1 means the same key was pressed as in the previous CALL KEY. 
A value of means no key was pressed. 

Example 

CALL KEY(0,K,SJ returns in K the 
ASCII code of any key pressed on the 
keyboard, and in S a value indicating 
whether any Hey was pressed. 



>100 CALL KEY(C,K,S) 



Program 

The program on the right illustrates 
a use of the KEY subprogram. It 
creates a sprits and then moves it 
around according to the input from 
the left side of the keyboard. 
Note that line 130 returns to lire 120 
if no key has been pressed. 



>100 CALL CLEAF. 

>110 CALL SPRITE(#1,33,5,96,1 

28) 
>120 CALL KEY(l,K,S) 
>130 IF S=0 THEN 120 
>140 IF K=5 THIN Y=-4 
>150 IF K=0 THEN Y=4 
>160 IF K=2 THEN X=-4 
>170 IF K=3 THEN X=4 
>180 IF K=l THEN X,Y=0 
>190 IF K>5 THEN X,Y=0 
>200 CALL MOTI0N(#l,Y,X) 
>210 GOTO 120 

(Press SHIFT C to stop the 

program. ) 



108 



TI Extended BASrC 



Tl Extended BASIC 



109 



LEN 



Format 

LEN [st ring-express ion) 

Description 

The LEN function returns the number of characters in string-expression. A 
space counts as a character. 

Examples 

PRINT LENC-ABCDE") prints 5. 



X = LEN(THIS ISA SENTENCE.") 
sets X equal to 19. 

DISPLAY LEN(""] displays 0. 

DISPLAY LEN(" ") displays 1. 



>10O PRINT LEN("ABCDE") 

>100 X=LEN(-THIS IS A SEN1ENC 
E.") 

>10O DISPUY LEN("") 

>100 DISPUY LEN(" -) 




CHAPTER 



4 



Format 

|LET] numeric-variable Inumeric-variable, ... 1 = numeric-expression 
(LET] string-variable \Mring variable. ... 1 = string-expression 

Description 

The LET statement assigns the value of an expression to the specified 
variablels). The computer evaluates the expression on the right and puts its 
value into the variable(s) on the left. If more than one variable is on the left, 
they are separated with commas. The LET is optional, and is omitted in the 
examples in this manual. AH subscripts In the variable(s) on the left are 
evaluated before any assignments are made. 

You may use relational and logical operators in numeric-expression. If the 
relation or logical value is true, numeric-variable is assignee a value of - 1 . If 
the relation or logical value is false, numeric-variable is assigned a value of 
(X 



Examples 

T = 4 puts the value 4 into T. 

X.Y.Z = 12.4 puts the value 12.4 into 
X t Y, and Z. 

A = 3< 5 puts - 1 into A since it is 
true that 3 is less than 5. 

B= 12 < 7 puts into B since it is not 
true that 12 is less than 7. 

I,A(I) = 3 puts 3 into AU) with 
whatever value I had before, and 
then puts 3 into I. 

L$,DS,BS = "B" puts "B" into L$, 
DS, and B$. 



>100 T=4 

>100 X,Y,Z=12.4 

>100 A=3<5 

MOO B = 12<7 

>L00 I,A(DO 

>100 L$,D$,B$="B' 



110 



TI Extended BASIC 



TI Extended BASI^ 



111 



LINK subprogram 



Format 

CALL LINK(s ubprogram name [, argument-list] ) 
Description 

The LINK subprogram is used, along with INIT, LOAD, and PEEK, to access 
assembly language subprograms. The LINK subprogram passes control and, 
optionally, a list of parameters from a Tl Extended BASIC program 10 an 
assembly language subprogram. 

Subprogram-name is the name of the subprogram to be called. It must have 
been previously loaded into the Memory Expansion with the CALL LOAD 
command or statement. Argument list is a list of variables and expressions 
as required by the specific assembly language subprogram being called. 



linput 



CHAPTER 



4 



Format 

UNPUT [ [*flte-number) [ f REC record-number] :] string-variable 
LINPUT \inpu\-prompt\ string-variable 

Description 

The LINPUT statement allows the assignment of an entire line, hie record, or 
(if there is a pending input record) the remaining portion of a file record into 
string-variable. No editing is performed on what is input, so commas. 
leading and trailing blanks, semicolons, colons, and quotation marks arc 
placed in string-variable as they arc given. 

Options 

A vflle-number may be specified. If the file is in RELATIVE format, a specific 
record may be specified with REC. The file must be a DISPLAY-type file. If no 
file is specified, an input-prompt may be displayed prior D accepting input 
from the keyboard. 



Examples 

LINPUT L$ assigns into L$ anything 
typed before ENTER is pressed. 

LINPUT "NAME: ":NMS displays 
NAME: and assigns into NMS 
anything typed before ENTER is 
pressed. 

LINPUT #1.REC M:LS(M) assigns 
into L$(M) the value that was in 
record M of the file that was opened 
as#l. 

Program 

The program on the ri^ht illustrates 
the use of LINPUT. It reads a 
previously existing file and displays 
only the lines that contain the word 
"THE". 



MOO LINPUT L$ 



>100 LINPUT "MKE: "NM$ 



MOO LINPUT #1.,REC M:LJ(M) 



MOO OPEN #1:"DSK1.TEXT1-',INP 

UT, FIXED 80,D[SPLAY 
M10 I? E0F(1) THEN CLOSE §1 

: : STOP 
M20 LINPUT 01: A$ 
>130 I=P0S(A$,'THE",1) 
M40 I? IO0 THEN PRINT A$ 
M50 GOTO 110 



112 



Tl Extended BASIC 



Tl Extended BASIC 



113 



LIST 



Format 

LIST ["devtce-narrie":] {line- number \ 

LIST [' device-name":] [start-line-number] - [end-line- number] 

Description 

The LIST command allows you to display program lines. If LIST is entered 
with no numbers following it. the entire program in memory is listed. If a 
number follows LIST, the line with that number is listed. If a number 
followed by a hyphen follows LIST, that line and all lines following it are 
listed. If a number preceeded by a hyphen follows LIST, all lines preeeeding 
it and that line are listed. If two numbers separated by a hyphen follow LIST. 
the indicated lines and all lines between them are listed. 

By pressing and holding a key until TI Extended BASIC responds, you may 
temporarily halt a listing so that ynu can look at it on the screen. Press any 
key again to restart the listing. Similarly, pressing SHIFT C (CLEAR) stops the 

listing. 

Options 

The listing normally is displayed on the screen. If you wish, you can instead 
direct the list to some other device, such as the optional thermal printer or 
RS232 interlace, by specifying device-name. 

Examples 

LIST lists the entire program in >LI5T 

memory on the display screen. 



LIST 100 lists lint 100. 

LIST 100- lists line 100 and all lines 
after it, 

LIST -200 lists all lines up to and 
including line 200. 

LIST 100-200 lists all lines from 100 
through 200. 

LIST 'TP" lists the entire program 
on the optional thermal printer. 

LIST "TP": -200 lists all lines up to 
and including line 200 on the 
optional thermal printer. 



>LIST 100 
>L]ST 100- 

>LIST -200 

>LJST 100-200 

>LIST •'TP 1 " 

>UST TP" : -200 



LOAD subprogram 



CHAPTER 



4 



format 

CALL LOAD{ "access-name" [, address. byte I [. „.] file-field, ...] ) 

Description 

The LOAD subprogram is used, along with INIT, LINK, and PEEK, to access 
assembly language subprograms. The LOAD subprogram loads an assembly 
language object file or direct data into the Memory Expansion for later 
execution using the LINK statement. 

The LOAD subprogram can specify one or more files from which to bad 
object data or lists of direct load data, which consists of an address followed 
by data bytes. The address and data bytes are separated by commas. Direct 
load data must be separated by file-field, which is a string expression 
specifying a file :'rom which to load assembly language object code. File-field 
may be a null string when it is used merely to separate direct load data 
fields. Use of the LOAD subprogram with incorrect values can cause the 
computer to cease to function and require turning it off and back on. 

Assembly language subprogram names (see LINK) are included in the file. 






1 14 



Tf Extended BASIC 



TI Extended BASIC 



115 



LOCATE subprogram 



Format 

CALL LOCATE[#sprite n um ber, dot-row, dot-colum n [....] ) 
Description 

The LOCATE subprogram is used to change the location of the given sprite(s) 
to the given dot-row(s) and dot-column(s;. Dof-rou 1 and doi-cotumn are 
numbered consecutively smarting with 1 in the upper left hand corner of the 
screen. Dot-row can be from 1 to 192 and dot -column can be from 1 to 256. 
(Actually dot-row can go up to 256. but the locations from 193 through 256 
are off the bottom of the screen,) The location of the sprite is the upper left 
hand corner of the characters) which define it. 



Program 

The program on the right illustrates 

the use of the LOCATE subprogram. 

Line 110 creates a sprite as a fairly 

quickly moving red exclamation 

point. 

Line 140 locates the sprite at a 

location randomly chosen in lines 

120 and 130. 

Line 150 repeals the process. 



>100 CALL CLEAR 

>110 CALL SPRITE(^1 J 33, 7 ,1.1. 

25,25) 

>120 YLCC=INT(RND*150+i; 
>130 XLCC=INT(RND*200+i; 
>U0 CALL LOCATE C^l.YLOC j XLOC 

) 
>150 GOTO 120 

(Press SHIFT C to stop the 

program, ) 



Also see the third example of the SPRITE subprogram. 



1J6 



Tl Extended BASIC 



LOG 



CHAPTER 



4 



Format 

LOG ( n u me ric-exp ress i o n ) 

Description 

The LOG function returns the natural logarithm of numeric-expression 
where numeric-expression is greater than zero. The LOG function is the 



inverse of the EXP function, 

Examples 

PRINT LOG13.4) prints the natural 
logarithm of 3.4 which is 
1.22377543 1E22. 

X = LOG(EXP{7.2)) sets X equal to 
the natural logarithm of e raised to 
the 7.2 power, which is 7.2. 

S = LOG(SQR(T)) sets S equal to the 
natural logarithm of the square root 
of the value ofT. 

Program 

The program at the right returns the 

logarithm of any positive number to 
any base. 



>100 PRINT LOGO. 4) 



>100 X=L0G(EXP(7.2)) 



>100 S=L0G(SQR(T)) 



>100 CALL CLEAS 

>110 INPUT "BASE: ":B 

>120 IF B<=1 TrEN 110 

>U0 INPUT "NUMBER: ":N 

>1A0 IF N<=0 TrEN 130 

>150 LG=L0G(N)/L0G(B) 

>160 PRINT "LOG BASE";E; '-0F"; 

N;"IS'-;LG 
>170 GOTO 110 

(Press SHIFT C to stop the 

program, ) 



Tl Extended BASIC 



117 



MAGNIFY subprogram 



Format 

CALLMAGN\FY(magniflcatlonfactor) 



Description 

The MAGNIFY subprogram allows you to specify the size of sprites and how 
many characters make up each sprite. All sprites are affected by MAGNIFY. 
Magnification-factors may be 1.2. 3, or 4. If no CALL MAGNIFY is in a 
program, the default magnification-factor is 1. 

A magnification-factor of 1 causes all sprites to be single size and 
unmagnified. This means that each sprite is defined only by the character 
specified when the sprite was created and takes up just one character 
position on the screen. 




A magnification-factor of 2 causes all sprites to be single size and magnified. 
This means that each sprite is defined only by the character specified when it 
was created, but takes up four character positions on the screen. Each dot 
position in the character specified expands to occupy four dot positions on 
the screen. The expansion from a magnification-factor of 1 is down and to 
the right. 




MAGNIFY subprogram 



CHAPTER 



4 



A magnificat ton-factor of 3 causes all sprites to be double size and 
unmagnified. This means that each sprue is defined by four character 
positions that include the character specified. The firs I character is the one 
specified when the sprite was created if its number is evenly divisible by 
four, or the next smallest number that is evenly divisible dv four. That 
character is the upper left quaner of the sprite. The next character is the 
lower left quarter of the sprite. The next character is the upper right quarter 
of the sprite. The final character is the lower right quarter of the sprite. The 
character specified when the sprite was created is one of the four that makes 
up the sprite. The sprite occupies four character positions on the screen. 




A magnification-factor of 4 causes all sprites to be double size and 
magnified. This means that each sprite is defined by four character positions 
that include t!ie character specified. The first character is the one specified 
when the sprite was created if its number is evenly divisible by four, or the 
next smallest number that is evenly divisible by four. That character is the 
upper left quarter of the sprite. The next character is the lower left quarter of 
the sprite. Th- next character is the upper right quarter of the sprite. The 
final character is the lower right quarter of the sprite. The character specified 
when the sprite was created is one of the four that makes up the sprite. The 
sprite occupies sixteen character positions on the screen. The expansion 
from a magnification-factor of 3 is down and to the right 




116 



Tl Extended BASIC 



TI Expended BASIC 



119 



MAGNIFY subprogram 



Program 

The following program illustrates a use of the MAGNIFY subprogram. When 
it is run, a liltle figure appears near the center of the screen. In a momen:, it 
gets to be twice as big. covering four character positions. In another moment, 
it is replaced by the upper left corner of a larger figure, still covering four 
character positions. Then the full figure appears, covering sixteen character 
postions. Finally it is reduced in size lo four character positions. 



Line 1 10 defines character 96, 

Line 120 sets up a sprite using 

character 96. By default the 

magnification factor is 1 . 

Line 140 changes the magnification 

factor to 2. 

Line 160 redefines character 96. 

Because the definition is 64 

characters leng, it also defines 

characters 97, 98. and 99. 

Line 180 changes the magnification 

factor to 4. 

Line 200 changes the magnification 

factor to 3. 



MOO CALL CLEAR 
>110 CALL CHAR(96/ J 1898FF3D3C 
3CE404") 
>120 CALL SPFUTE(#1, 96, 5,92,1 

>130 GOSUB 230 

>140 CALL MAGNIFY(2) 

>150 GOSUB 230 

>160 CALL CKAR(96,"0133C3417F 
3F07070707077E7C40000080COCO 
80FCFEE2E3EOEOE06060606070") 

>170 C0SUB 230 

>180 CALL MAGNIFY(A) 

>190 GOSUB 230 

>200 CALL MAGNIFY(3) 

>210 GOSUB 230 

>220 STOP 

>230 REM DELAY 

>240 FOR DELAY=1 TO 530 

>250 NEXT DELAY 

>260 F.ETURN 



MAX 



CHAPTER 



4 



Format 

MAXfnumeric-evpressIoni ,numeric-expression2\ 
Description 

The MAX function returns the larger of riumerlc-expresslonl and numeric- 
expression2. If they are equal, then their value is returned. 

Examples 

PRINT MAX(3.8J prints 8. >100 PRINT MAX (3 ,8) 

F = MAX(3E12, 1800000) sets F equal >100 F=MAX(3E1S, 1800000) 
to3E12. 

G = MAX{- 12 -4) setsG equal to MOO G=MAX(-12,-4) 

-4. 

L = MAX(A,B) sets L equal to 7 if A is >100 L=MAX(A,B) 
7 and B is - 5 



120 



TI Extended BASIC 



Tl Extended BASIC 



121 



MERGE 



Format 

MERGE ["] device-filename ["] 

Description 

The MERGE command merges lines in filename from the given device into 
the program lines already in the computer's memory. If a line number in 
filename duplicates a line number in the program already in memory, the 
new line replaces the old line. Otherwise the lines are inserted in line number 
order among the lines already in memory. The MERGE command does not 
clear breakpoints. Also, MERGE can only be used with diskettes. 

NOTE: Files can only be merged into memory if they were saved using the 
MERGE option. Sec the SAVE command for mere information. 



Example 

MERGE DSK 1 .SUB merges the 
program SUB into the program 
currently in memory. 

Program 

If the program on the right is saved 
on DSK1 as BOUNCE with the merge 
option, it can be merged with 
programs such as the one shown on 
the next page. 



>MERGE DSKI.SUB 



>100 CALL CLEAR 

>110 RANDOMIZE 

>l40 DEF RND50-INT(RNW0-25) 

>150 COSUB 10000 

XLOOOO FOR AA-1 TO 20 

>10010 QQ=RND50 

XLOO20 LL=RND50 

>10030 CALL M0TION(#l,QQ,LL) 

XL004G NEXT AA 

XL005Q RETURN 



MERGE 



On the right is a program you can 
put into the cemputer's memory. 



CHAPTER 



Now merge BOUNCE with the above 
program. 

The program that results from 
merging BOUNCE with the above 
program is shewn on the right. 



Note that line 150 is from the 
program that was merged, not from 
the program that was in memory. 



4 



>120 CALL CHAR06/M8183CFFFF 

3C1818") 
>130 CALL SPRITi(#l, 96,7,92,1 

28) 
>150 G0SUB 500 
>160 STOP 

>MERGE DSK1. BOUNCE 



>LIST 

>100 CALL CLEAR 

>110 RANDOMIZE 

>120 CALL CHAR(96,"18183CFFFF 

3C1818-) 
>130 CALL SPRITI(#1,96,7,92,1 

28) 
>l40 DEF RND5Q=INT{RND*?0-25) 
>150 G0SUB 10000 
>160 STOP 

XLOOOO FOR AA=1 TO 20 
>10010 QQ=RND50 
>10020 LL=RND50 
XL0030 CALL MOTI0N(#l,QQ,LL) 
>10040 NEXT AA 
>10050 RETURN 



>SAVE "DSK1. BOUNCE' 1 , MERGE 



122 



TI Extended BASIC Tl Extended BASIL 



123 



MIN 



Format 

M I N[ n a rn e ri c-exp ress tonl.nu meric-exp ression2) 

Description 

The MIN function returns the smaller of numeric-expression 1 and numeric- 
expression2. If they are equal then their value is returned. 

Examples 

PRINT MAX;3,8) prints 3. >100 PRINT HAX(3,S) 

F=MIN(3E 12, 1800000] sets Fequal >100 F=MIN(3E12, 1800000) 

to 1800000. 

G = MIN(- 12, -4) sets G equal to >100 G=MIN(-12,-4) 

- 12. 

L = VIIN(A.B) sets L equal to -5 if A >100 L=MIN(A,3) 

is 7 and B is - 5. 



MOTION subprogram 



CHAPTER 



4 



Format 

CALL MOTION #sprite-n umber, row-velocity, co lumn-velocity [....] ) 

Description 

The MOTION subprogram is used to specify the rcw-velociiy and cclumn- 
velocity of a sprite. If both the row- and column-velocities are zero, the sprite 
is stationary. A positive row-velocity moves the sprite down and a negative 
value moves it ap. A positive column-velocity moves the sprite to the right 
and a negative value moves it to the left. Ef both row-velocity and column- 
velocity are nonzero, the sprite moves smoothly at an angle in a direction 
determined by :he actual values. 

The row- and column-velocities may be from - 128 to 127 A value close to 
zero is very skw. A value far from zero is very fast. When a sprite comes to 
the edge of the screen, it disappears and reappears in the corresponding 
position on the other side of the screen. 



Program 

The program at the right illustrates a 
use of the MOTION subprogram. 
Line 110 creates a sprite. 

Lines 120 and L30 set values for the 
motion of the sprite. 



Line 140 displays the current values 
of the motion of the sprite. 

Line 150 sets the sprite in motion. 



Lines 160 and 170 complete the 
loops that set the values for the 
motion of the sprite. 



>100 CALL CLEAR 

>110 CALL SPRITE(#1, 33, 5,92,1 
24) 

>120 FOR XVEL=-16 TO 16 STEP 

2 

>130 FOR YVEL— 16 TO 16 STEP 

2 

>UQ DISPLAY AT (12,11) :XVEL; 

YVEL 

>150 CALL M0TI0N(#1,YVEL,XVEL 

) 

>160 NEXT YVEL 
>170 NEXT XVEL 



124 



TI Extended BASIC 



TI Extended BASIC 



125 



NEW 



Format 

NEW 

Description 

The NEW command clears the memory and screen and prepares the 
computer for a new program All values are reset and all defined characters 
become undefined. Any open flies are closed. Characters 32 through 95 are 
reset to the:r standard representations. The TRACE and BREAK commands 
are canceled. 

Be sure to save the program that you have been working on before you enter 
NEW as it is unrecoverable by any means once NEW has been entered. 



next 



CHAPTER 



4 



Format 

NEXT control-variable 

See ON BREAK, ON WARNING, and RETURN (with ON ERROR) for the use 
of NEXT clause with those statements. 

Description 

The NEXT staement is always paired with the FOR-TO-STEP statement for 
construction of a loop. Control-variable must be the same as control-variable 
in the FOR-TO-STEP statement. The NEXT statement mar not appear in an 
IF-THEN-ELSE statement. 

The NEXT statement controls when the bop is repeated. Each time the 
NEXT statement is executed, control-variable is changed by the value 
following STEP in the FOR-TO-STEP statement, cr by 1 if there is no STEP 
Clause. If the value of control-variable is between initial-value and limit, the 
loop is executed again, [f it is not, control passes to the statement after 
NEXT. Thus the value of control -variable at the end of the loop is always the 
first value outside the range of the FOR-TO-STEP statement. See FOR -TO 
STEP for more informal ion. 



Program 

The program on the right illustrates 
a use of the NEXT statement in lines 
130 and 140, 



>100 T0TAL=0 

XL10 FOR COUNT=:0 TO STEP - 

2 
>120 TOTAU TOTAL+COUNT 
>130 NEXT COUNT 
>l40 FOR DELAYS TO 100:: NEXT 

DELAY 
>150 PRINT TOTAL, COUNT; DELAY 
>RUN 

30 -2 101 



126 



Tt Extended BASIC ^ Extended BASIC 



127 



NUMBER 



OLD 



CHAPTER 



Format 

NUMBER [initial-tine] [.increment] 
NUM iinifialWine] [,incremenl\ 

Description 

The NUMBER command generates sequenced line numbers, allowing entry 
of program lines without typing the line numbers. If initial-line and 
increment are not specified, ihe line numbers start at 100 and increase in 
increments of 10, You may give the command at any time in the Command 
Mode. If a line already exists, the current line is displayed. You may type 
over it to replace it, alter it using the edit fune.ions, or press ENTER to 
confirm it. To leave the NUMBER mode, press ENTER when a line comes up 
with no statements on it or press SHIFT C (CLEAR) when any line is 
displayed. NUMBER may be abbreviared as NUM. 

Options 

You may specify an initial-line and/or increment. 

Example 

In the following, what you type is 
UNDERLINED . Press ENTER after 
each line. 

NUM instructs the computer to 
number starting at 100 with 
increments of 10. 



NUM 110 instructs the computer to 
number starling at 1 10 with 
increments of 10. Change line 1 10 to 

z= n. 

NUM 105,5 instructs the computer to 
number starting at line 105 with 
increments of 5. 
Line 1 10 already exists. 



>NUM 
>100 X=A 
>110 Z=10 
>120 
>NUM 110 

110 Z=ll 
>120 PRINT (Y+X)/Z 
>130 

> NUK 105,5 
>105 Y£7 

110 Z=ll 

>H5 

>Lisr 

100 x=4 
105 Y=7 

no z=n 

120 PRINT (Y+X)/Z 



4 



format 

OLD ["1 device-prog ram name [ ') 
Description 

The OLD command loads prog ram-name from device into memory. The 
program must first have been put on device using the SAVE command. OLD 
closes any open files and removes the program currently in memory before 
loading program-name. To add program lines from another program to a 
program in memory, see the MERGE command. 

Device can be several different things. If it is CS1 or CS2, designating one of 
the two possib.e cassette recorders, then no program-name is given. The 
program loaded is the program that is or the cassette, Instructions on 
operating the cassette recorder are displayed on tne screen. 

See the Disk Memory System Manual for instructions on using OLD with 
diskettes. 



Examples 

OLD CS 1 loads a program from a 
cassette recorder into the computer's 
memory. 

OLD" DSK1. MYPROG" loads the 
program MYPROG into the 
computer's memory from the 
diskette in disk drive one. 

OLD DSK.DISK3.UPDATE80 loads 
the program UPDATE80 into the 
computer's memory from the 
diskette named DISK3. 



>0LD CS1 



>0LD "DSK1. MYPROG" 



>0LD DSK« DISK^JPDATESO 



128 



t: Extended BASIC 



TI Extended BASIC 



129 



ON BREAK 



ON ERROR 



CHAPTER 



Format 

ON BREAK STOP 
ON BREAK NEXT 

Description 

The ON BREAK statement determines the action taken if a breakpoint is 
encountered during the execution of a program. The default action is STOP, 
wliich causes program execution to halt and the standard breakpoint 
message to be printed. The alternative is NEXT, which transfers control to 
the next line without a breakpoint occurring. 

You can use ON BREAK NEXT to have a program ignore breakpoints which 
you have put in a program for debugging purposes. (NOTE: ON BREAK 
NEXT does not have any effect on a BREAK statement which is not followed 
by a program line number. The breakpoint will occur even if the statement 
ON BREAK NEXT has been executed.) When ON BREAK NEXT is in effect, 
the external break, SHIFT C (CLEAR), does not stop a program. In that case 
only SHIFT Q (QUIT) can stop the program. SHIFT Q (QUIT) erases the program 
and returns you to the main screen and may interfere with the proper 
operation of some external devices such as disk drives. 



Program 

The program on the right illustrates 
the use of ON BREAK. Line 110 sets 
a breakpoint in line 150. Line 120 
sets breakpoint handling to go to the 
next line. A breakpoint occurs in line 
130 in spite of line 120, Enter 
CONTINUE. No breakpoint occurs in 
line 150 because of line 120. SHIFT C 
(CLEAR) has no effect during the 
execution of lines 140 through 160 
because of line 120. Line 170 
restores the normal use of SHIFT C 
(CLEAR). 



>100 CALL CLIAR 

>110 BREAK 1?0 

>120 ON BREAK NEXT 

>130 BREAK 

>140 FOR A=l TO 50 

>150 PRINT "SHIFT C IS DISABL 

ED." 
>160 NEXT A 
>170 ON BREAK STOP 
>180 FOR A=l TO 50 
>190 PRINT "NOW IT WORKS." 
>200 NEXT A 



4 



format 

ON ERROR STOP 

ON ERROR Une-number 

Description 

The ON ERROR statement determines the action taken if an error occurs 
during the execution of a program. The default action is STOP, which causes 
the standard error message to be printed and program execution to halt. The 
alternative is to give a line- number which transfers control to that line in 
case of an error. 

Once an error has occurred and control has been transferred, error handling 
reverts to the normal action, STOP. If you wish to have any new errors 
handled differently, an ON ERROR statement must be executed again. 

If a line-number is specified by ON ERROR, the line-number must be the 
beginning of a subroutine similar to that called by GOSUB. It should end 
With a RETURN statement. See RETURN (with ON ERROR) for more 
Information, 

NOTE: A transfer of control following the execution of an ON ERROR 
Statement acts like the execution of a GOSUB statement. As with GOTO and 
GOSUB, you must avoid transfers to and from subprograms. The most 
common resul: of an illegal transfer into a subprogram is a syntax error on a 
Statement that appears to be correct. 



130 



TI Extended BASIC 



TI Extended BASIC 



131 



ON ERROR 



ON GOSUB 



CHAPTER 



4 



Program 

The program at the right illustrates 
the use of ON ERROR. Line 110 
causes any error to pass control to 
line 160. 

An error occurs in line 1 30 and 
control is passed to line 160. 

Line 170 causes the next error to 

pass control to line 230. Line 180 

finds out about the error using CALL 

ERR. 

Line 190 transfers control to line 230 

if the error isn't in the expected line. 

Line 200 transfers control to tine 230 

if the error isn't the one expected. 

Line 210 changes the value of XS to 

an acceptable value. Line 220 

returns con-rol to the line in which 

the error occurred. 

Line 240 reports the nature of the 

unexpected error and the program 

stops, 



>100 CALL CLEAR 
>110 ON ERROR 160 
>120 X$="A" 
>130 X^VAL(X$) 

>140 PRINT X; "SQUARED IS'-;X*); 
>150 STOP 

>160 REM ERROR SUBROUTINE 
>170 ON ERROR 230 
>180 CALL ERR (CODE, TYPE, SEVEft 
,LINE) 

>190 IF LINEO130 THIN RETURu 

>200 IF C0DEO74 THEM RETURN 

230 
>210 X$="5" 
>220 RETURN 
>230 REM UNKNOWN ERROR 

>2A0 PRINT "ERROR"; CODE;" IN 

LINE"; LINE 

>RUN 

5 SQUARED IS 25 



qN numeric-expression GOSUB line-number [....] 
QfJ numeric-expression GO SUB line-number [....] 

Description 

The ON. ..GOSUB statement transfers control to the subrout ine beginning al 
lifie-number in the position corresponding to the value oi' numeric- 
expression. Other than giving a choice, it acts the same as the GOSUB 
statement, but it is more efficient in that it may require fewer lines of code 
tjjan using an IF-THEN-ELSE statement. 

numeric-expression must have a value from 1 through th? number of line- 
n umbers. 

Examples 

ON X GOSUB 1000,2000,300 
transfers control to 1000 if X is 1. 
2000 if X is 2. and 300 if X is 3. 



>100 ON X GOSUB 1000,2000,300 



ON P-4 GOSUB 200.250,300, 
800.170 transfers control to 200 if 
P~4 is 1 (P is 5). 250 if P - 4 is 2, 
300 if P - 4 is 3, 800 if P - 4 is 4. and 
!70ifP-4is5. 



MOO ON P-4 GOSJB 200,250,300 
,800,170 



132 



TI Extended B/^SIC TI Extendetl BASIC 



133 



ON GOSUB 



Program 

The program on the right illustrates 
a use of ON... GOSUB. Line 220 
determines where to go according to 
the value of CHOICE. 



>100 CALL CLEAR 

>110 DISPLAY AT(ll,l): "CHOOSE 

ONE OF THE FOLLOWING:" 
>120 DISPLAY AT(13,1):"1 ADD 

TWO mJMBERS.'- 
>130 DISPLAY AT(U,1): ,J 2 MUL 

riPLY TWO NUMBERS." 
>l4G DISPLAY AT(15,1):"3 SUB 

TRACT TWO NUMBERS." 
>150 DISPLAY AT(20,l):"YQUR C 

tfOICE:" 
>160 DISPLAY AT(22,2): "FIRST 

KfUMBER:" 
>170 DISPLAY AT ( 23 >1):' 'SECOND 

NUMBER:" 
>180 ACCEPT AT (20, 14) VALIDAT 

E (NUMERIC): CHOICE 
>L90 IF CH0ICE<1 OR CHOICER 

THEN 180 
>200 ACCEPT AT (22,16)VALIDAT 

K(NUMERIC):FIRS1 
>210 ACCEPT AT (23,l6)VALIDAT 

S (NUMERIC): SECOND 
>220 ON CHOICE GOSUB 240,260, 

280 

>230 GOTO 180 
>240 DISPLAY AT ( j,l): FIRST; "P 

LUS" ; SECOND; "EQUALS"; FIRST+S 

iCOND 
>250 RETURN 
>260 DISPLAY AT(j,l) : FIRST; "T 

[MES"; SECOND; "EQUALS"; FIRST* 

SECOND 
>270 RETURN 
>280 DISPLAY AT(3,l) : FIRST;"M 

[NUS";SE:ONDj "EQUALS"; FIRST- 
SECOND 
>290 RETURN 

[Press SHIFT C to stop the 

program,) 



ON GOTO 



CHAPTER 



4 



Format 

ON numeric-expression GOTO line-number [,...] 
QN numeric-expression GOTO line-number [„..| 

Description 

The ON.. .GOTO statement transfers control to the line-number in the 
position corresponding to the value of numeric-expression. Other than giving 
a choice, i; acts the same as the GOTO statement, but it is more efficient in 
that it may require fewer lines of code than using an IF-THEN -ELSE 
statement. 

Numeric-expression must have a value from 1 through the number of line- 
numbers. 



Examples 

ON X GOTO 1000,2000,300 
transfers control to 1000 if X is 1. 
2000 if X :s 2, and 300 if X is 3. The 
equivalent statement using an IF- 
THEN-ELSE statement is IF X= 1 
THEN 10CO ELSE IF X = 2 THEN 
2000 ELSE IF X - 3 THEN 300 ELSE 
PRINT "ERROR!"::STOP. 

ON P- 4 GOTO 200.250.300,800,170 
transfers control to 200 if P -4 is 1 
(P is 5). 250 if P - 4 is 2, 300 if P - 4 
Is 3, 800 iJP-4 is 4, and 170 if P~4 
la 5, 



MOO ON X GOTO 1000,2000 J 00 



>100 ON P-4 GOTO 200,250,300, 
800,170 



134 



Ti Extended BASEC 



Tl Ex tend ec BASIC 



135 



ON GOTO 



ON WARNING 



CHAPTER 



Program 

The program on tiie right illustrates 
a use of ON.. .GOTO. Line 220 
determines where to go according to 
the value of CHOICE. 



>100 CALL CLEAR 

>110 DISPLAY AT(ll,l): "CHOOSE 

ONE OF THE FOLLOWING:" 
>120 DISPLAY AT(13,1):"1 ADD 

TWO NUMBERS." 
>130 DISPLAY AT(l4,l):"2 MUL 

TIPLY TWO NUMBERS." 
>l40 DISPLAY AT(15,1):"3 SUB 

TRACT TWO NUMBERS." 
>150 DISPLAY AT(2O,l)i"Y0UR C 

HQICE:" 
>160 DISPLAY AT(22,2): "FIRST 

NUMBER:" 
>170 DISPLAY AT(23,1): "SECOND 

NUMEER:" 
>180 ACCEPT AT (20,14}VALIDAT 

E (Nl"MERIC):CHOICE 
>190 IF CH0ICK1 OR CH0ICE>3 

THEN 180 
>200 ACCEPT A? (22,16)VALIDAT 

E NUFERIC): FIRST 
>210 ACCEPT AT (23 , 16) VALIDAT 

E NUMERIC) :SECOND 
>220 ON CHOICE GOTO 2^0,250,2 

70 
>230 DISPLAY AT(3,l) : FIRST; "? 

LUS " jSECOND;' EQUALS" ; FIRST+S 

ECOND 
>240 GOTO 180 
>250 DISPLAY AT(3,l):FIRSTr : T 

IKES-jSECONDi'-EQUALS"; FIRST* 

SECOND 
>260 GOTO 180 
>270 DISPLAY AT (3 , l) : FIRST ; ; *M 

INUS"; SECOND; 'EQUALS'; FIRST- 
SECOND 
>280 GOTO 180 

(Press SHIFT C to step the 

program. ) 



4 



Format 

ON WARNING PRINT 
ON WARNING STOP 
ON WARNING NEXT 

Description 

The ON WARNING statement determines the action taken if a warning 
occurs during ihe execution of a program. The default action is PRINT, 
which causes the standard warning message to be printed and the program 
to continue execution. One alternative is STOP, which causes the standard 
warning message to be printed and the program to halt execution. The other 
alternative is NEXT which causes the program to continue execution without 
printing any message. 



Program 

The program on the right illustrates 
the use of ON WARNING. Line 110 
Sets warning handling to go to the 
next line. Line 120 therefore prints 
the result wit Lout any message. 
Line 130 sets warning handling to 
the default, printing the message and 
then continuing execution. Line 140 
therefore prints 140. then the 
warning, and then continues. 
Line 150 sets warning handling to 
print the warning message and then 
stop execution. Line 160 therefore 
prints 160 and then the warning 
/message and then stops. 



>100 CALL CLEAR 
>110 ON WARNING NEXT 
>120 PRINT 120,5/0 



>130 ON WARNING PRINT 
>l40 PRINT 140, VO 



>150 ON WARNING STOP 
>160 PRINT 160,5/0 
>170 PRINT 170 
>RUN 

120 9.99999^:+** 

140 

* WARNING 

NUMERIC OVERFLOW IN 140 

9.999992+** 
160 

* WARNING 

NUMERIC OVERFLOW IN 160 



136 



TI Extended BASIC 



Tl Extended BASIC 



137 



OPEN 



OPEN 



CHAPTER 



4 



Format 

OPEN #file-mimber:dev ice-jllenanie [file-organization] [file-type] 
[,open-mode [,record-type[ 

Description 

The OPEN statement prepares a BASIC program to use data files stored on a 
diskette or cassette by providing a link between file-number and a file. To sei 
up this link, the OPEN statement describes a file's characteristics. If the file 
already exists, the description that is given in the program must match the 
actual characteristics of the file. Files on cassettes are not checked, however, 
so errors may occur if the characteristics do not match. 

F\le-number must be included in the OPEN statement. Statements which 
refer to files do so with a file- number from Through 255. File number is 
the keyboard and screen of the computer. It cannot be used for other files 
and is always open, You may assign the other numbers as you wish, with 
each file having a different number. File-number is entered as a number sign 
(*) followed by a numeric expression that, when rounded to the nearest 
integer, is a number from to 255, and is no: the number of a file that is 
already open, 

Device must also be included in the OPEN statement. If device is CS1 or 
C52, designating one of the two cassette recorders, then no file-name is 
given. Instructions on operating the easselte recorder are displayed on the 
screen. 

If device is DSK1. DSK2, orDSK3, designating one of the three disk drives, 
then file-name is the name of a file on the diskette in the given drive. If 
device is DSK, diskette- name, where diskette-name is the name of a diskette 
in one of the drives, then file-name is the name of a file on the diskette 
named diskette-name. The computer searches the drives, starting at DSK1. 
until it finds the diskette wiLh the given name. Then it looks for file-name on 

The other information may be in any order, cr may be omitted. If an item is 
omitted, the computer assumes certain defaults, which are described below. 

File organization can be either sequential or random. Records in a sequential 
file are read or written one after the uther. Records in random files can be 
read or written in any order. Random files may also be processed 
sequentially, To indicate which structure the file has, enter either 
SEQUENTIAL for sequential files or RELATIVE for random files. You may 
optionally specify the initial number of records on a file by following the 
word SEQUENTIAL or RELATIVE with a numeric expression. If you do not 
specify the file -organization, the default is SEQUENTIAL. 



file-type may be either DISPLAY or INTERNAL. Files can be written either 
in human-readable form, called ASCII (DISPLAY), or in machine-readable 
form, called binary (INTERNAL). Binary records may take up less space and 
are processed more quickly by the computer. However, ii the Information is 
going to be printed or displayed, ASCII format is usually a better choice, 

To specify that you wish the file to be in ASCII format, enter DISPLAY. To 
specify binary format, enter INTERNAL. If you do not specify a file-type , the 
default is DISPLAY. Usually INTERNAL is the best choice when using files 
on cassettes or diskettes, and DISPLAY is the best choice when using files on 
the thermal printer or RS232 Interface. 

Open-mode may be UPDATE, INPUT. OUTPUT, or APPEND. The computer 
may be instructed thai the file may be both read and wrtten on, that it may 
only be read, that it may only be written on. or that it may only be added to. 
However, if the file is marked as protected, it cannot be written on and may 
only be opened for input. 

To be able both to read from and write to a file, specify UPDATE. To just 
read from a file, specify INPUT, To just write to a file, specify OUTPUT, Tc 
only add to a file, specify APPEND. Append mode can only be specified for 
VARIABLE length records. If you do not specify an open-mode, the default is 
UPDATE. 

Note that if an unprotected file already exists on a diskette, specifying an 
open-mode of OUTPUT to the same file name writes over the existing file 
with the new data. You can prevent this by moving to ths end of :he file by 
using the RESTORE statement with the proper record or opening the file in 
the APPEND mode. 

Record-type may be either VARIABLE or FIXED. Files may have records that 
are all the same length or that vary in length. If all records are the same 
length, any that are shorter are padded to make up the difference. Any that 
are longer may be truncated \c the proper length. You may specify records of 
variable length by entering VARIABLE. You specify records of fixed length 
by entering FIXED. 

If you like, ycu may specify a maximum length of a record by following 
VARIABLE or FIXED with a numeric expression. The maximum record is 
dependent on the device used. If you do not specify a record length, the 
default is 80 tor diskettes. 64 for casseUes, 80 for the RS232 interface, anc 
32 for the thermal primer. 

RELATIVE files must have FIXED length records. If you do not specify a 
record-type for a RELATIVE file, the default is FIXED. 



138 



TI Extended BASIC 



Tl Extended BASIC: 



139 



OPEN 



SEQUENTIAL files may be cither FIXED or VARIABLE. If you do not specify 
a record- type for a SEQUENTIAL file, the default is VARIABLE. A fixed - 
length file may be reopened for either SEQUENTIAL or RELATIVE access 
independent of previous file -org an iz a ti on assignments. 



Examples 

OPEN #T"CSl'\FIXED.OUTPUT 
opens a file on cassette one. The file 
is SEQUENTIAL, kept in DISPLAY 
format, in OUTPUT mode with 
FIXED length records with a 
maximum length of 64 bytes. 

OPEN * f 23:"DSK.MYDISK.X". 
RELATIVE lOCUNTERNAL.UPDATE, 
FIXED opens a file named "X". The 
file is on the diskette named MY DISK 
in whichever drive that diskette it is 
located. The file is RELATIVE, kept 
in INTERNAL format with FIXED 
length records with a maximum 
Length of 60 bytes. The file is 
opened in UPDATE mode and starts 
with 100 records made available for 
it. 

OPEN #243:A$, INTERNAL, if A$ 
equals "DSK2ABC" ', assumes a file 
on the diskette in drive two with a 
name of ABC. The file is 



>100 OPEN #1:-CS1", FIXED, OUT 

PUT 



>300 OPEN ^"DSK.JYYDISK.X", 
RELATIVE 100, INTERNAL, UPDATE 

, FIXED 



>100 OPEN #243 :A$, INTERNAL 



OPTION BASE 



CHAPTER 



4 



Format 

OPTION BASE 
OPTION BASE 1 

Description 

The OPTION BASE statement sets the lowest allowable subscript of arrays to 
zero or one. The default is zero. If an OPTION BASE staiement is used, it 
must have a lower line number than any DIM statement or reference to any 
array. There may only be one OPTION BASE statement in a program, and it 
applies to all array subscripts The OPTION BASE statement may not appear 
in an IF-THEN-ELSE statement. 



Example 

OPTION BASE 1 sets the lowest 
allowable subscript of all arrays to 
one. 



>100 OPTION BASE 1 



format, in UPDATE mode with 
VARIABLE length records with a 
maximum length of 80 bytes. 

OPEN #1 7 :"TP". OUTPUT prepares 
the thermal printer for printing. 



>100 OPEN #17: "T?", OUTPUT 



140 



TI Extended BASIC 



Tl Extended BASIC 



141 



PATTERN subprogram 

Format 

CALL PATTER N[#sprite-num be r, character- value [,...] } 

Description 

The PATTERN subprogram allows you to change the character pattern of a 
sprite without affecting any other characteristics of the sprite. 

Sprite-number specifies the sprite you are using. Character-value may be 
any integer from 32 ro 143. See the CHAR subprogram for information on 
defining the pattern for characters. See the MAGNIFY subprogram for more 
information. 



Program 

The program on the right illustrates 
the use of the PATTERN 
subprogram. Lines 110 through 140 
build a floor 

Lines 150 though 200 define 
characters 96 through 107. 



Line 210 creates a sprite in the 
shape of a wheel and starts it moving 



>ioo :all clear 

>110 :ALL C0L0R(12,16,16) 
>120 FOR A=19 TO 24 

>130 :all hchar(a, 1,120,32) 

>140 \JEXT A 

>150 A$=-'010718212l4l4lFFFF4: 

4l212119070080E09884848282Fr 

FF8232848498EO00" 
>160 3$="01061820305C46818142 

46242C1807008060183424624281 

8l623A0CO4l8EO00 : ' 
>170 C$="0106182C244642818146 

5C3020180700306018040C3A6281 

814262243418E000" 
>180 CALL CHAR(96,A$) 
>190 CALL CHAR ( 100 >B$) 
>200 CALL CHAR ( 104, C$) 
>210 CALL SPRITE(#l,96 f 5,130, 

1,0,8) 



PEEK subprogram 



CHAPTER 



4 



torn** 

CALL PEEK{address, numeric variable-list) 

pe»criP tion 

The PEEK subprogram is used, along with INIT, LINK, and LOAD, to access 
^eembly language subprograms. The PEEK subprogram returns values in 
the variables n numeric-variable-list that correspond with the values in the 
byte specified by address and the bytes following it. PEEK can be used 
Without assembly language subprograms, but the information obtained is oi 
little use. 

Detailed instructions en the use of INIT. LINK. LOAD, and PEEK arc included 
with custom written programs that may be available on diskette or cassette. 

Indiscriminate use of PEEK may cause the computer to "lock up" and 
require it to te turned off and back on before further use 

Example 

CALL PEEK(8192,X1,X2,X3,X4) 
returns the values in locations 8192, 
8193, 8194, and 8195 in XI, X2. X3. 
and X4. respectively. 



>100 CALL PEEK(8192,X1,X2,X3, 
X4) 



Line 220 makes the sprite double 

size. 

Lines 230 through 270 make the 

spokes of the wheel appear to move 

as the character displayed is 

changed. 

Also sec the third example of the 
SPRITE subprogram. 



>220 CALL MAGNIFY (3) 

>230 TOR A=96 TO 104 STEP 4 

>240 CALL PATTERN (#1, A) 

>250 ?0R DELAY =1 TO 5: : NEXT 

DELAY 

>260 KEXT A 

>270 GOTO 230 

(Press SHIFT C to stop the 
program. ) 



142 



TI Extended BASIC 



TI Extended BASIC 



143 



PI 



Format 

PI 

Description 

The PI function returns the value of x as 3.14159265359. 

Example 

V0LUME=4/3*PI'6A3 sets VOLUME 

equal to four thirds times pi times 

six cubed, which is the volume of a 

sphere with a radius of six. 



>100 VOLUME=4/3*PI*6A3 




CHAPTER 



4 



>100 X=POS(-'FAW'yA" ( l) 



>100 Y=P0S("APftN-yA",2) 



format 

pOStstri ng 1 , st ring2. numeric-express ion) 

Description 

The POS function returns the position cf the first oceurance of s(rtng2 in 
string 1 - The search begins at ttie position specified by numeric-expression. II 
no match is found, the function returns a value of zero. 

Examples 

X = POS("PAN*,"A M) sets X equal 
to 2 because \ is the second letter in 
PAN. 

Y = FOSr APAN'yA*\2) sets Y equal 
to 3 because Lhe A in the third 
position in A? AN is the first 
occurance of A in the portion of 
APAN that was searched. 

Z = POS{"PAN","A \3) sets Z equal 
to because A was not in the part of 
PAN that was searched. 

RsPOSrPABNAN'V'AN M) sets K 
equal to 5 because the first 
occurance of AN starts with the A in 
the fifth position in PABNAN. 

Program 

The program at the right illustrates a >100 CALL CLEaR 

use of POS. In it any input is >110 PRINT "ENTER A SENTENCE. 

searched for spaces, and is then 

printed with each word on a single >120 INPUT X$ 

li ne< >130 S=PGS(X$," ,1) 

>140 IF S=0 THEN PRINT X$ :: 

PRINT : ; GOTO 110 
>150 V $=SEG$U$,1,S):: PRINT 

Y$ 
>160 X$=SEG$(:<$,S+1,LEN(X$)) 
>17Q GOTO 130 
(Press SHIFT C to stop the 
program. ) 



>100 Z^POSf-'PAN'/'Ay) 



>100 RrP0S( "PABNAN", ;i AN" 1 1) 



144 



TI Extended BASIC 



TI Extended EASIC 



145 



POSITION subprogram 

Format 

CALL POSIT.ON,* sprife . nurnber , do , rou , do(co(umn ) 

Description 

Example 

of sprite #1. 

Also see the third example of the 
SPRITE subprogram. 



INT 



CHAPTER 



4 



[^file-number [,REC record-number] :] [print-list] 

iption 

PRINT statement allows you to transfer the values of the elements of the 

._ 1 print-list to the display screen or optionally to an external file or 
p _e. Print-list consists of string constants, numeric constants, string 
ibles, numeric variables, numeric expressions, string expressions, and/or 

TAB function. Each element in print-list is separated from the others by 

licolon, a comma, or a colon. 

semicolon, comma, and colon control spacing for the screen or a file 
ied in DISPLAY format. A semicolon causes the next element to be 
;d immediately adjacent to the previous element. A comma causes the 
. element of print-list to be put in the next print field. Each print field is 
:haracters long. The number of print fields depends on the record length 
le device being used. On the screen, the print fields are at positions 1 and 
If the cursor is past the start of the last print field, the next item is 
.ted on the next line. A colon causes the next element to be put on the 
:t line or record. To print several blank lines, you may put several colons 
:r the PRINT statement. However, they must have spaces between them 
Ithey are not confused with ths statement separator symbol (::). 

iparator may be placed following the last element of print-list, which 
:cts the placement of the next element of the next PRINT, PRINT... USING, 
PLAY (without AT), or DISPLAY. ..USING (without AT) statement written 
I the same device. It causes the next output statement to be considered to 
a continuation of the current one unless it is a PRINT statement with a 
,C clause. 

fhen printing a new line on the screen, everything (except sprites) is 
boiled up one line (so the top line is lost) and the new line is printed at the 
Dttom of the screen. 

options 

the ^file-number determines ths file that is to be printed on. If it is omitted 
br #0," the screen is used. Otherwise file-number must be the number of a file 
hat is already open. See OPEN. 

The REC clause is used to specify the record on which you wish to print the 
lelements in pnnt-list. REC may only be used with files that were opened as 
IRELATIVE files. See OPEN. 



146 



TI Extended BASIC 



TI Extended BASIC 



147 



PRINT 



In printing to INTERNAL format files, the comma and semicolon both place 
the elemenls in print-list adjacent to each other. In DISPLAY format files, the 
comma and semicolon act as described above, with the semicolon placing the 
element adjacent to the previous element and the comma putting the 
element in the next print field. 



Examples 

PRINT causes a blank line to appear 
on the display screen. 

PRINT "THE ANSWER IS*;ANSWER 
causes the string constant THE 
ANSWER IS to be printed on the 
display screen, followed immediately 
by the value of ANSWER. If 
ANSWER is positive, there will be a 
blank for the positive sign after IS. 

PRINT X:Y/2 causes the value of X to 
be printed on a line and the value of 
Y/2 to be printed on the next line. 

PRINT #12.REC 7: A causes ihe value 
of A to be printed on the eighth 
record of tf e file that was opened as 
number 12. (Record number is the 
first record ) 

PRINT #32 A.B,C, causes the values 
of A, B. and C to be printed on the 
ne^r record of the file that was 
opened as number 32, The final 
comma creates a pending output 
condition. The next PRINT statement. 
directed to file number 32 will print 
on the same record as this PRINT 
statement unless it specifies a record, 
thereby closing the pending output 
condition. 



>100 PRINT 

>100 PRINT THE ANSWER IS"; AN 
SWER 



PRINT 



PRINT *1.REC 3:A,B followed by 
PRINT #1:C.D causes A and B 10 be 
printed in record 3 of the file that 
was opened as number 1 and C and 
D to be printed in record 4 of the 
same file. 

program 

The program at the right prints out 
various values in various positions 
on the dispiav screen. 



CHAPTER 



>100 PRINT X:Y/2 



>100 PRINT #12,REC 7: A 



>100 PRINT #32:A,B,C, 



4 



>100 PRINT #1,?X.C 3:A,B 
>150 PRINT #1:C,D 



>100 CALL CLEAR 

>110 PRINT 1;2J;4j5;6;7;8;9 

>120 PRINT 1,2. 3, 4, 5, 6 

>130 PRINT 1:2 3 

>l40 PRINT 

>150 PRINT i;2.3; 

>160 PRINT 4;5.6/4 

>RUN 

12 3 4 5 6 7 3 9 

1 2 

3 4 

5 6 

1 

2 

3 

1 2 3 4 5 1.5 



14H 



TI Extended BASIC 



TI Extended BASIC 



149 



PRINT USING 



Format 

PRINT [^file-number [,REC record- number] J USING string-expression-.print-hsi 
PRINT {^file-number [,REC record number] J USING line-number -.print-list 

Description 

The PRINT.. .USING statement acts the same as PRINT with the addition oi" 
the USING clause, which specifies the format to be used. String-expression 
defines the format in the manner described in IMAGE. Line-number refers to 
the line number of an IMAGE statement, See the IMAGE statement for more 
information on the use of string-express ion. 



Examples 

PRINT USING "##* ##' :32.5 prints 
32.50. 

PRINT USING "THE ANSWER IS 
##*#*': 123.98 prints THE ANSWER 
IS 124.0. 

PRINT USING 185:37.4,-86.2 prints 
the values of 37.4 and - 86.2 using 
the IMAGE statement in line L85. 



>100 PRINT U£ING ' l UM.M'".32. 
5 

>100 PRINT USING "THE ANSWER 
IS #M.r-:123.98 

>100 PRINT USING 185:37.4,-86 
.2 



RANDOMIZE 



CHAPTER 



4 



format 

RANDOMIZE [numeric-expression] 

Description 

The RANDOMIZE statement resets the random number generator to an 
unpredictable sequence. If RANDOMIZE is followed by a numeric-expression. 
the same sequence of random numbers is produced each time the statement 
Is executed with that value for the expression. Different values give different 
sequences. 



Program 

The program at the right illustrates a 
use of the RANDOMIZE statement. It 
accepts a value for numeric- 
expression and prints the first 10 
values obtained using the RND 
function. 



>100 CALL CLEAR 

>110 INPUT "SEED: ":S 

>120 RANDOMIZE S 

>130 FOR A=l TO 10 "PRINT A;R 

ND::NEXT A: : PRINT 
>l40 GOTO 110 

(Press SHIFT C to stop the 

program.) 



150 



Tt Extended BASIC 



TI Extended BASIC 



151 



REM 



Format 

REM character-string 

Description 

The REM statement allows you to enter remarks into your program. The 
remarks mav be anything that you wish, but arc usually used to divide 
sections of programs and to explain what the following section is meant to 
do. No matter what follows REM. including the statement separator symbol 
{::). remarks are not executed and have no effect on program execution. They 
do, however, take up space in memory. 

Example 

REM BEGIN SUBROUTINE identifies 
a section beginning a subroutine. 



>100 REM BEGIN SUBROUTINE 



RESEQUENCE 



CHAPTER 

4 



format 

RESEQUENCE [initial-line] [.increment] 
PES [initial-line] [.increment] 

Description 

The RESEQUENCE command changes the line numbers cf the program in 
memory. If no initial-line is given, the line numbering starts with 100. If no 
increment is gven, an Increment of 10 is used. RESEQUENCE may be 
abbreviated as RES. 

In addition to renumbering lines, any line references in the statements 
BREAK, DISPLAY... USING, GOSUB, GOTO, IF-THEN-ELSE, ON ERROR, 
0N...GOSUB. ON. ..GOTO. PRINT. ..USING, RESTORE, RETURN, and RUN 
are also changed so that they refer to the same lines of code as before 
resequencing. '.( a line referred to in a statement does not exist, the line 
number is replaced with 32767. 

If. because of the initial-line and increment chostn, the program requires 
Unes larger than 32767, the resequencing process is halted and the program 
is unchanged. 

Examples 

RES resequences the lines of the >RES 

program in memory to start with 
100 and number by 10s, 

RES 1000 resequences the lines of >RES 1000 

the program in memory to start with 
1000 and numoer by 10s. 

RES 1000,15 resequences the lines >RES 1000,15 

of the program in memory to start 
With 1000 and number by 15s. 

RES , J 5 resequences the Lines of the >RES ,15 

program in memory to start with 
100 and number by 15s. 



154 



Tl Extended BASK Tl Extended BASIC 



155 



RESTORE 



RETURN (with GOSUB) 



CHAPTER 



Format 

RESTORE [line-number] 

RE STORE #f de-number [,REC record- number] 

Description 

The RESTORE statement can be used either with DATA statements or with 
files. When used with DATA statements. RESTORE sets the DATA statement 
which will bf used by the next READ statement. If no line-number is given, 
the DATA statement with the lowest numbered line is used by the next 
READ statement. If line-number is given, then the DATA statement with 
that line number or [ir it is not a DATA statement) the next DATA statement 
following it is used. 

When used with files, the RESTORE statement sets the record that is used 
by the next PRINT. INPUT, or LINPUT statement referring to file number. If 
no REC clause is given, the next record is the first record in the file, record 
number 0. If the REC clause is present, record- number specifies me next 
record to be used. 

If there is pending output because of a previous PRINT, DISPLAY. 
PRINT.. .USING, or DISPLAY... USING, then that pending record is written on 
the file before the RESTORE statement is executed. Pending input data is 
removed by the RESTORE statement. 



Examples 

RESTORE sets the next DATA 
statement to be used to the first 
DATA statement in the program. 

RESTORE ISO sets the next DATA 
statement to be used to the DATA 
statement at line 130 or, if line 130 
is not a DATA statement, to the next 
DATA statement after line 130, 

RESTORE #1 sets the next record Lo 
be used by the next PRINT, INPUT, 
or LINPUT statement using Ilk # 1 to 
be the first record in the file. 

RESTORE #4,REC H5 sets the next 
record to be used by the next PRINT, 
INPUT, or LINPUT statement using 
file *4 to be record H5. 



>100 RESTORE 



>100 RESTORE 130 



>100 RESTORE tfl 



>100 RESTORE K,REC H5 



4 



format 

RETURN 
Description 

gee also RETURN (with ON ERROR). 

RETURN used with GOSUB transfers control back to the statement after the 
qOSUB or ON... GOSUB which was most recently executed. 

program 

rhe program on the right illustrates >100 CALL CLEA r 

a use of RETURN as used with >110 INpuT AMOUNT DEPOSITED: 

GOSUB. The program figures . :AM0 UNT 

interest on an amount of money put >120 tnpuT "ANNUAL INTEREST R 

in savings. AIE: ":RATE 

>1j0 IF RATE<1 THEM RATE=RATE 

*100 
>140 PRINT "NUMBER OF TIMES C 

OMPOUNDED" 
>150 INPUT "ANNUALLY: ":C0MP 
>160 INPUT ' -STARTING YEAR: ": 

Y 
>170 INPUT "NUMBER OF YEARS: 

":M 
>18} CALL CLEAR 
>190 FOR A^Y TO Y+N 
>2O0 GOSUB 240 
>21G PRINT A,INT(ANOUNT*100+. 

5)/100 
>220 NEXT A 
>230 STOP 

>240 FOR B=l TO C0NP 
>250 AM0UNT=AM0UNT+AM0UNT*RAT 
E/(C0MP*10G) 
>260 NEXT B 
>27C RETURN 



156 



TI Extended BASK 



-r T1 Ex te] 



nded BASIC 



157 



RETURN (with ON ERROR) 



Format 

RETURN [line-number] 
RETURN [NEXT) 

Description 

See also RETURN (with GOSUB). 

RETURN is used with ON ERROR. After an ON ERROR statement has been 
executed, an error causes transfer to the line specified in the ON ERROR 
statement. That line, or one after it, should be a RETURN statement. If 
RETURN is given without anything following it, control is returned to the 
statement on which the error occurred and the program executes it again. If 
RETURN is followed by line-number, control is transferred to the line 
specified and execution starts with that line. If RETURN is followed by 
NEXT, control is transferred to the statement following the one that caused 
the error. 



Program 

The program on the right illustrates >100 

the use of RETURN with ON ERROR. >110 

Line 120 causes an error to transfer >120 

control to line 170. Line 130 causes >130 

an error. Line 140, the next line after >140 

the one that causes the error, prints >150 

140, Line 170 checks to see if the >160 

error has occurred four times and >170 

transfers control to 220 if it has. Line >180 

180 increments the error counter by >190 

one. Line 1GO prints 190. Line 200 >200 

resets the error handling to transfer >210 

to line 170. Line 2 10 returns to the >220 

line that caused the error and RUN 

executes it again. Line 220, which is 190 

executed only after tiie error has 190 

occurred four times, prints 220 and 190 

returns to the line following the line 190 

that caused the error. 220 

140 
Also see the example of the ON 
ERROR statement. 



CALL CLEAR 

A=l 

ON ERROR 170 

X=VAL("D-') 

PRINT 1^0 

STOP 

REM ERROR HANDLING 

IF A>4 THEN 220 

A=A+1 

PRINT 190 

ON ERR0F. 170 

RETURN 

PRINT 220 : : RETURN NEXT 




CHAPTER 



> 



4 



format 

Description 

iThe RND function returns the next pseu do- random number in the current 
Sequence of pseudo-rancom numbers. The number returned is greater than 
Jdr equal to zero and less than one. The sequence of random numbers 

turned is the same every time a program is run unless the RANDOMIZE 

atement appears in the program. 

camples 

)LOR16 = INT(RND*16)+ 1 sets 
ijOLOR16 equal to some number 

itom 1 through 16. 

■£■'■ 

i^ALUE = INT(RMD* 16) + 10 sets 

IVALUE equal to some number from 

i^0 through 25. 



MOO COLOR16=INT(RND*16)+1 



>10Q VALUE=INT(RJID*16)+1D 



,$J-<8) = INT(RND* (B - A + 1 )) + A sets 
Ji(8) equal to some number from A 
.through B. 



>100 LL(8)*INT(RJID*(B-A+l))+A 



158 



TI Extended BASK :TI Extended BASIC 



159 



RPT$ 



WJN 



CHAPTER 



4 



Format 

RPT$(stri ng-expressio n , nu me ric-express ion ) 

Description 

The RFT$ function returns a string equal to numeric-expression repetitions 
of string-expression. If RPT$ produces a string longer than 255 characters, 
the excess characters are discarded and a warning is given. 



Examples 

MS = RPT$(* , ABCD' ,4) sets M$ equal 
to "ABCDABCDABCDABCD'V 

CALL CHAR(96.RPTS("OOO0FFFF", 
8)) defines characters 96 through 99 
with the string "OO0OFFFF0OOOFFFF 
O0OOFFFF0OOOFFFF0O00FFFFOOO0 
FFFFO0O0FFFF0O00FFFF' \ 

PRINT USING:RPT$r#'\40);X$ 
prints the value of X$ using an 
image that consists of 40 number 
signs. 



>100 M$=RPT$( ,I ABCD ,, ,4) 

>100 CALL CHAR(96,RFT$( 1, OOO0F 
FFF',8)) 



>100 PRINT USING RP1$( , '# , ',4C) 



Format 

RUN ["device. program-name" \ 
'■'RUN [line-number] 

; Description 

■ r The RUN command, which can also be used as a statement, starts program 

% execution. The program to be run is first loaded into memory from device. 

| program-name if that option is specified. The program is then checked for 

|, certain errors, such as FOR -NEXT loops that are missing the NEXT 

1 Statement, and errors in syntax in statements. The values of all numeric 

I variables are set to zero and the values of all string variables are set to null (a 

^string of zero characters). The program is then executed. 

| Options 

?. If device. program-name is specified, the program to be run is loaded from 

3 the specified device. The program and data currently in memory are lost. 

■If line-number is specified, the program in memory is run starting at line- 
/number. 

Examples 

;|RUN causes the computer to begin 
V execution of the program in memory. 



■;.:' RUN 200 causes the computer to 
J begin execution of the program in 
,V memory starting at line 200. 

| RUN '*DSK1,?RG3" causes the 

'$f; computer to bad and begin 

^ execution of the program named 

PRG3 from the diskette in disk 

drive 1 . 



>RUN 

>RUN 200 

MOO RUN 200 

>RUN '0SK1.PRG3" 
>320 RUN "DSK1.PRG3' 



1&3 



Tl Extended BASIC 



Tl Extended BASIC 



161 



RUN 



Program 

The program at the right Illustrates 
the use of the RUN command used 
as a statement. It creates a "menu" 
and lets the person using the 
program chose what other program 
he wishes to run. The other 
programs should RUN this program 
rather than ending in the usual way, 
so that the menu is given again after 
they are finished. 



>100 CALL CLEAR 




>110 PRINT "1 PROGRAM 1." 




>120 PRINT "2 PROGRAM 2." 




>1J30 PRINT "3 PROGRAK V 




>l40 PRINT "L END." 




>150 PRINT 




>160 INPUT "YOUR CHOICE: ": 


:C 


>170 IF C=l THEN RUN "DSKl, 


.PR 


Gl" 




>180 IF C=2 THEN RUN "DSK1, 


.PP. 


G2" 




>190 IF C=^ THEN RUN "DSK1 


.PP. 


G3" 




>200 IF C=4 THEN STOF 




>210 GOTO IOC 





;ave 



CHAPTER 



4 



WE device. program-name [.PROTECTED] 
VVE device. program-name [ t MERGEJ 

ascription 

tie SAVE command allows you to copy the program in memory to an 
•rnal device under the name program-name. By using the OLD 
imand. you can later recall the program into memory. The method of 
Kving onto a cassette recorder is given In the User's Reference Guide. The 
Eiethod of saving onto a diskette is given in the DtsA: Merrory System 
aanual. SAVE clears breakpoints that have been put into a program. 

ptlons 

lly the PROTECTED option is available with cassette recorders. 

using the keyword PROTECTED, you may optionally specify that a 
agram can only be run or brought into memory with OLD. The program 

lot be listed, edited, or saved. This is not the same as using the 
Section available with the Disk Manager Module. NOTE: Be sure to keep 
i unprotected copy of any program because the protection feature is not 
versable. If you also wish to protect the program from bsing copied, use the 
itect feature of the Disk Manager module. 

fou may optionally specify that the program is to be available for merging 
lth another program by using the key word MERGE. Only programs saved 
1th the key word MERGE may be merged with another program. 



camples 

WE DSK1.PRG1 saves the 
program in memory on the diskette 
jpi disk drive 1 under the name PRG1. 

iAVE DSK1. PRG 1, PROTECTED 
ives the program in memory on the 
ette in disk drive 1 under the 
ie PRG 1 . The program may be 
.ded into memory and run, but it 
| may not be edited, listed, or resaved. 

f SAVE DSK 1. PRG 1, MERGE saves the 
program in memory on the diskette 

in disk drive 1 under the name 
\ PRGl. The program may later be 

merged with a program in memory 
' by using the MERGE command 




>SAVE DSK1.PRG1 



>SAVE DSK1.PRG1, PROTECTED 



>SAVE DSK1. PRGl, MERGE 



162 



Tl Extended BASIC 



T! Extended BA3IC 



163 



SAY subprogram 



Format 

CALL SAY( word-string [.direct-string] [....]) 
Description 

The SAY subprogram causes the computer to speak word-string or the value 
specified by direct-string when the Solid State Speech™ Synthesizer (sold 
separately) is connected. For a complete description of SAY, see the manual 
that comes with the Speech Editor Command Module and Speech 
Synthesizer (both sold separately). 

The value of word string is any string value listed in Appendix L, If it is 
given as a literal value, it must be enclosed in quotation marks. The value of 
direct-string is a value returned by SPGET. The value of direct-string may be 
altered to add suffixes as described in Appendix M. 

Word-strings and direct-strings must be alternated in the CALL SAY 
subprogram. If you wish to have two direct-strings or ivord-strings spoken 
consecutively, you may put in an extra comma to indicate the position of the 
item omitted. 



Examples 

CALL SAY(* HELLO, HOW ARE 
YOU") causes the computer to say 
"Hello, how are you." 

CALL SAY(,A$..B$) causes the 
computer to say the the words 
indicated by AS and B$, which must 
have been returned by SPGET. 

Program 

The program on the right illustrates 
using CALL SAY with a word string 
and three direct strings. 



>100 ^ALL SAY(' 'HELLO, HOW ARE 
YOU') 

CALL SAY{,A$,,B$) 



>100 CALL SPGET("HOW',X$) 
>110 CALL SPGET ("ARE ,? ,Y$) 
>120 CALL SPGET("YOU",Z$) 
>130 CALL SAY(-'HELLO",X$,,Y$, 



SCREEN subprogram 



CHAPTER 



4 



Format 

CALL SCREEV(color-code) 



Description 

The SCREEN subprogram changes the color of the screen to the color 
specified by color-code. All portions of the screen that do not have characters 
V on them, or have characters or portions of characters that are color 1 
■■ (transparent), are shown as the color specified by color-code. The standard 
\" screen color for TI Extended BASIC is 8, cyan. 

; The color codes arc; 



Code 


Color 


Code 


Color 


1 


Transparent 


9 


Medium Red 


2 


Black 


10 


Light Red 


3 


Medium Green 


11 


Dark Yellow 


4 


Light Green 


12 


Light Yellov 


5 


Dark Blue 


13 


Dark Green 


6 


Light Blue 


14 


Magenta 


7 


Dark Red 


15 


Grav 


8 


Cyan 


16 


White 



Examples 

£ 'CALL SCREEN (8) changes the screen 
; to cyan, whici is the standard screen 
f color. 

/ CALL SCREEN (2) changes the screen 
\ to black. 



MOO CALL SCREEN(8) 



>100 CALL SCRE^N(2) 



164 



TI Extended BASIC 



TI EM ended BASIC 



165 



SEG$ 



Format 

SEG${string-expression,positton f length) 

Description 

The SEGS function returns a substring of a string. The string returned starts 
at position in string-expression and extends for length characters. If position 
is beyond the end of string-expression, the null string ("") is returned. If 
length extends beyond the end of string-expression, only the characters to 
the end are returned 



Examples 

X$= SEGSPFIRSTNAME 
LASTNAME*\1,9] sets X$ equal to 
"FIRSTNAME". 

YS = SEGSC FIRSTNAME 
LASTNAME'M 1,8) sets Y$ equal to 
'■LASTNAME". 

ZS= SEGSC FIRSTNAME 
LASTNAME'\10,1) sets Z8 equal to 



>100 X$=SEG$( "FIRSTNAME LASTW 
AME",1,9) 

>100 !f$=SEG$( "FIRSTNAME LASTJf 
AMEM1,8) 

>100 Z$=SEG$("FIRSTN/ME LASTM 
AME",10,1) 




CHAPTER 



4 



ifiinu me ri c-exp resston J 
description 

: SGN function returns 1 if numeric-expression is positive. if it is zero, 
- 1 if it is negative. 



samples 

'SGN(X2)= 3 THEN 300 ELSE 400 

sfers control to line 300 if X2 if 
sitlve and to line 400 if X 2 is zero 
■ negative. 

SGN[X) + 2 GOTO 200,300,400 
sfers control to line 200 if X is 
gatlve. line 300 if X is zero, and 
ae 400 if X is positive. 



>100 IF SGN(X2)=1 THEN 300 EL 
SE 400 



>I00 ON SGN(X)+2 GOTO 200,300 
,400 



■■&■ 



PRINT SEGSlAS.B.Cj prints the 
substring of A$ starting at character 
B and extending for C characters. 



>100 PRINT SEG$(A$,B,C) 



166 



TI Extended BASIC 



tl Extended BASIC 



167 



SIN 



Format 

SI N ( rad ia n -express ion) 

Description 

The sine function gives the trigonometric sine of radian-expression. If the 
angle is in degrees, multiply the number of degrees by PI/ 180 to get the 
equivalent angle in radians. 



Program 

The program on the right gives the 
sine of several angles. 



>100 A=. 5235987755982 

>110 B=30 

>120 C=45*PI/180 

>130 PRINT SIN(A);SIN(B) 

>140 PRINT SIN(B*PI/180) 

>150 PRINT SIN(C) 

>RUM 

.5 -.9880316241 

• 5 

.7071067812 




CHAPTER 



4 



format 
jj&IZE 

description 

fltie SIZE command displays the number of unused bytes of memory left in 
vibe computer If the Memory Expansion peripheral is attached, the number 
fflf bytes available is given as the amount of stack free and the amount of 
^program space free. A byte is the memory space required for such things as 
l^one character or digit, or one TI Extended BASIC keyword. 

ijjf the Memory Expansion is not attached, the space available is the amount 
,$[ space left after the space taken up by the program, screen, character 
Jjpattern defini.ions, sprite tables, color tables, string values, and the like is 
^fcibtracted. 

W. the Memory Expansion is attached, the space available in the stack is the 
Unmount of space left after the space taken up by string values, information 
Ijfcboul variables, and the like is subtracted. Program space is the amount of 
ipace left after the space taken up by the program and the values of numeric 
Variables is subtracted. 



Examples 

&ZE gives the available memory. 



>SI2E 

13928 BYTES FREE 



SIZE gives the available memory. If 
the Memory Expansion peripheral is 
attached, stack and program space 
given. 



>SIZE 

13928 BYTES OF STACK FREE 
24511 BYTES OF PROGRAM 
SPACE FREE 



168 



TI Extended BASIC : Tl Extended BASIC 



169 



SOUND subprogram 



JOUND subprogram 



CHAPTER 



Value 


Range 


Duration 


1 to 4250 




- 1 to -4250 


Frequency 


[Tone) 110 to 44733 




INoise) -1 to -8 


Volume 


to 30 



Format 

CALL SOU.VD(du rat ion frequency 1 , volume 1 |. ...frequency4 t vclume4\ ) 
Description 

The SOUND subprogram tells the computer to produce tones or noise. The 
values given control three aspects of the sound: Duration; frequency: and 
volume. 

Description 

The length of the sound in 
thousandths of a second. 
What sound is played. 

How loud the sound is. 

Duration is from .001 to 4.250 seconds, although it may vary up to l/60th of 
a second. The computer continues performing program statements while a 
sound is being played. When you call the SOUND subprogram, the computer 
waits until the previous sound has been completed before performing the 
new CALL SOUND. However, if a negative duration is specified, the previous 
sound is stopped and the new one is begun immediately. 

Frequency specifies the frequency of the note Lo be played with a value from 
1 10 to 44733. (NOTE: This range goes higher than the range of human 
hearing. People vary in their ability tc hear high notes, but generally the 
highest is approximately a value of 10000.) The actual frequency produced 
by the computer may vary up to 10 percent. Appendix D lists the 
frequencies of some common notes. 

A value of - 1 to - 8 specifies one of eight different types of noise. 



Frequency Description 



-1 
-2 
-3 
-4 

-5 
-6 

-7 
-8 



Periodic Noise Type 1 

Periodic Noise Type 2 

Periodic Noise Type 3 

Periodic Noise that varies with the frequency af the 

third tone specified 

White Noise Type 1 

White Noise Type 2 

White Noise Type 3 

White Noise that varies with the frequency of the 

third tone specified 



A maximum of three tones and one noise can he played simultaneously. 

Volume specifies the loudness of the note or noise. Zero is loudest and 30 is 
softest. 



4 



Ifsamples 

:ALL SOUND( 1000, 1 10,0) plays A 
|l>elow low C loudly for one second. 

If'CALL SOUND(500. 110,0, 131,0 196, 
i;3) plays A below low C and low C 
f loudly, and G below C not as loudly. 
|all for half a second. 

.CALL SOUNLX4250, -8.0) plays loud 
white noise for 4.250 seconds, 

[CALL SOUNDfDUR.TONE^OLj 
[plays the tone indicated by TONE for 
a duration indicated by DUR, at a 
volume indicated by VOL. 

Program 

■The program on the right plays the 
?. 13 notes of the first octave that is 
^available on the computer. 



>100 CALL SOUNL(1000, 110,0) 

>100 CALL S0UNI(500, 110,0, 131 
,0,196,3) 



>100 CALL S0UND(4250,-&,0) 

>100 CALL SOUND (DUR, TONE, V 
OL) 



>100 X=2A(1/12) 

>110 FOR A=l TO 13 

>120 CALL SOUNDClQO^lOfcXAA^ 

) 
>130 NEXT A 



170 



TI Extended BASK" 1 



TI Extended BASIC 



171 



SPGET subprogram 



SPRITE subprogram 



CHAPTER 



Format 

CALL SPGET [word-string .return-string) 

Description 

The SPGET subprogram returns in return-string the speech pattern that 
corresponds to word-string. For a complete description of SPGET see the 
manual thai comes with the Speech Editor Command Module and Solid 
State Speech™ Synthesizer (both sold separately}. 

The value of word-string is any string value listed in Appendix L. If it is 
given as a literal value, it must be enclosed in quotation marks. The value of 
return-string is used with SAr\ and may be altered to add suffixes as 
described in Appendix M. 

Program 

The program on the right illustrates >100 CALL SPGET("HOW,X?) 

using CALL SPGET. >110 CALL sPGET(-'ARE"Jy$) 

>120 CALL SPGET("YOU",Z$) 

>i;0 CALL SAY ( "HELLO " J X$ W Y$, 



4 



CALL SPRIT E( #sprite-n umber ,character*vaiue sprite-color, dot- row, dot- 
column, \ t row- velocity, column-velocity] [,...] ) 

Description 

The SPRITE subprogram creates sprites. Sprites are graphics which have a 
color and a location anywhere on the screen. They can be set in motion in 
any direction at a variety of speeds, and continue their motion until it is 
Changed by the program or the program stops. They move more smoothly 
than the usual character which jumps from one screen position to another. 

Sprite-number is a numeric expression from 1 to 28. If the value is that of a 
sprite that is already defined, the old sprite is deleted and replaced by the 
new sprite. If the old sprite has a rou> or column-velocity, and no new one is 
,' specified, the new sprite retains the old velocities. 

Sprites pass ever fixed characters on the screen. When two or more sprites 
are coincides, the sprite with the lowest sprite number covers the other 
Sprites. While five or more sprites are on the same screen row, the one(s) 
with the highest sprite number(s) disappear. 

Character-value may be any integer from 32 to 143. See the CHAR 
■ subprogram for information on defining characters. The character-value can 

be changed by the PATTERN subprogram. The sprite is defined as the 
: character given and, in the case of double -sized sprites, the next three 
^characters. See the MAGNIFY subprogram for more information. 

.| ; Sprite-color may be any numeric expression from 1 to 16. It determines the 
^foreground color of the sprite. The background color of a sprite is always 1, 
^transparent. See the COLOR and SCREBN subprograms for more 
J information. 

$, Dot-row and dot-column are numbered consecutively starting with 1 in the 
upper left hand corner of the screen. Dot-row can be from 1 to 192 and dor 
■ column can be from 1 to 256. i Actually dot row can go up to 256. but the 
I positions fron 193 through 25B are off the bottom of the screen.) The 
position of the sprite is the upper left hand corner of the character(s) which 
define it. 

Information about the position of a sprite can be found using the POSITION. 
COINC, and DISTANCE subprograms. The location of a sprite can be 
changed using the LOCATE subprogram. COLOR changes the co;or of a 
sprite. Sprites can be deleted with the DELSPR1TE subprogram. 

When a breakpoint occurs or the program stops, sprites cease to exist. They 
do not reappear with CONTINUE. 



172 



Tl Extended BASIC 



Tl Extended BASIC 



173 



SPRITE subprogram 



chapter 



SPRITE subprogram 



Options 

Rowvefocity and column-velocity may optionally be specified when the 
sprite is created. If both row- and column-velocity are zero, the sprite is 
stationary. A positive row-velocity moves the sprite down and a negative 
value moves it up. A positive column-velocity moves the sprite to the right 
and a negative value moves it lo the left. If both row-velocity and column- 
velocity are non-zero, the sprite moves at an angle in a direction determined 
by the actual values. 

Row- and column-velocity may be from - 128 tc 127. A value close to zero is 
very slow. A value far from zero is very fast. When a sprite comes to the edge 
of the screen, it disappears and reappears in the corresponding position on 
the other side of the screen. The velocity of a sprite may be changed using 
the MOTION subprogram. 

Programs 

The following three programs show some possible uses of sprites. The third 
one uses all the subprograms that can relate to sprites except for COLOR and 
DISTANCE, 

>100 CALL CLEAR 

>110 CALL CHAfl;96/'FFFFFFFFFF 
FFFFFF") 

>120 CALL CHAR[98/183C7EFFFF 
7E3C1B") 

>13Q OALL CHAR(100,"FOOFFOOFF 
OOFFOOF 1 ') 
Line 140 creaies a dark blue sprite in >U0 CALL SPRITE (#1,96,5,92,1 
the center of the screen and a dark 24 , §2 , 100 , 7 , 1 , 1 ) 

red sprite in the upper left corner of >150 CALL SPRITE (#28,33,16,12 

the screen. Line 150 creates a white ,48, 1,1) 

sprite near the upper right corner of 
the screen and starts it moving 
slowly at a 45 degree angle down 
and to the right. The sprite is an 
exclamation point. 

Line 160 creates a sprite at the >160 CALL SPRITE(#15, 96,14,1, 

upper left corner of the screen and l , 127, -128 ) 

starts it moving very fast at a 45 >170 GOTO 170 

degree angle up and to the right. (Press SHIFT C to stop the 

program.) 



4 



*TJie program on the right makes a 
rather spectacular use of sprites. 
Jjne 110 defines character 96. 
>tlne 150 defines the sprites, 28 in 
■ :gll. The sprite-number is the current 
lvalue of A. The character-value is 
§£6. The sprite<:olor is INT(A/3) - 3. 
tie starting dot-rou; and dot-column 
: 92 and 124. the center of the 
creen. The row- and column- 
^pelocittes are chosen randomly using 
ithe value of A*INT(RND*4.5) 
|-2.25+A/2*SGN(RND-.5). Line 
'170 causes the sequence to repeat. 



>100 CALL CLEAR 

>110 CALL CHAR(96,"0008D81C7F 
1C0808") 

>120 RANDOMIZE 

>130 CALL SCREE>I(2) 

>140 FOR A=l TO 28 

>150 CALL SPRITE(#A,96,INT(A/ 
3)+l, 92, 124, A*ENT(RND*4>5)-2 
.25+A/2*SGN(RID-.5),A*INT(RN 
D*4,5)-2.25+A/2*SGN(RND-.5)) 

>160 NEXT A 

>170 GOTO 140 
(Press SHIFT C to stop the 
program) 



iThe following program uses all the subprograms that can relate to sprites 
fexcept for COLOR and DISTANCE. They are CHAR. COINC. DELSPRITE, 
:ATE, MAGNIFY. MOTION, PATTERN. POSITION, and SPRITE. 

le program creates two double sized magnified sprites in the shape of a 
Tson. walking along a floor. There is a barrier that one of them passes 
'rough and the other jumps through- The one that jumps through goes a 
r ^tle faster after each jump, so eventually it catches the other one. When it 
[does, they each become double size unmagnified sprites and continue 
■Walking. When they meet the second time, the one that has been going faster 
[disappears and the other continues walking. 

>100 CALL CLEAR 



iLines 1 10. 120. 140. 150, 250. and 
|260 define the sprites. 



Line 130 sets the meeting counter to 
zero. 



Lines 170 through 200 build the 
floor. 



>110 Sl$="OlO303OlO3O303O3O3O 

3O3O303O303O38OCOCO8O>:OC0C0C 

OC0C0C0C0COC0C0E0" 
>120 S2$="010303010307DF1B1BO 

3O3O306OCOCOE8OCOCO8OCOEOFOD 

8CCCOC0C0603O303S" 
>130 COUNTS 
>l40 CALL CHAR(96,S1$) 
>150 CALL CHAR(100,S2$) 
>160 CALL SCREEN (14) 
>170 CALL COLOR (14 ,13 43) 
>180 FOR A=19 TO 24 
>190 CALL HCHARU, 1,136,32) 
>200 NEXT A 



174 



Tr Extended BASIC 



TI Extended BASIC 



175 



SPRITE subprogram 



SPRITE subprogram 



CHAPTER 



4 



Lines 210 through 240 build the 
barrier. — 



Line 270 sets the starling speed oi 
the sprite that will speed up. 

Line 290 sets the sprites in motion. 



Line 300 creates the illusion of 
walking. 

Line 320 checks to see if the sprites 
have met. 

Line 330 transfers control if the 
sprites have met. Lines 340 and 350 
check to see if the sprite has reached 
the barrier and transfer control if it 
has. 

Line 360 loops back to continue the 
walk. Lines 370 through 460 handle 
the sprites running into each other. 
Lines 380 and 390 stop them. 



Line 400 checks to see if it is the first 
meeting. Line 410 increments the 
meeting counter. Line 420 finds their 
position. 

Line 430 makes them smaller. 
Line 440 puts them on the floor and 
moves the fast one slightly ahead. 

Line 450 starts them moving again. 



>210 CALL COLORCU, 15,15) 
>220 CALL VCHAR(l4, 22,128, 6) 
>230 CALL VCHAR(l4 > 23,128,6) 
>240 CALL VCHAR (14,24,128,6) 
>250 CALL SPRirE(#l,9£,5jll3 

,129, #2, 96, 7, 113,9) 
>260 CALL MAGNIFY(4) 
>270 XDIR=4 
>280 PAT=2 

>290 CALL M0TI0N(#1,0,XDIR,#2 

,0,4) 
>300 CALL PATTERNS #1,98+PAT,# 

2,98-PAT) 
>310 PAT=-PAT 
>320 CALL COINC(ALL,CC) 

>330 IF C0O0 THEN 37C 

>340 CALL P0SITI0N(#1,YP0S1,X 

P0S1) 
>350 IF XP0S1H36 AND 3CP0SK1 

92 THEN 470 

>360 GOTO 300 

>370 REM COINCIDENCE 

>380 CALL MOTION(#1,0, II, #2,0, 

0) 

>390 CALL PATTERN(#l,9o,#2,96 

) 
>4Q0 IF C0UNT>0 THEN 540 
>410 CCUNT=C0UNT+1 
>420 CALL FOSITION(#1,YPOS1,X 

P0Sl,#2,YP0S2,XPOS2) 

>430 CALL MAGNIFY(3) 
>440 CALL LOCATE (#1,YP0S1+16, 
XP0S1+S , #2 , YPCS2+16 , XP0S2) 

>450 CALL MOTION (#1,0,)(DIR, #2 

,0,4) 
>460 GOTO 340 



Lines 470 thrcugh 530 handle the 
fast sprite jumping through the 
barrier. Line 4B0 stops it, Line 490 
finds where it is. 

Line 500 puts it at the new location 

beyond the barrier. 
: Lines 5 10 and 520 start it moving 
' again, a little faster. 

Lines 540 through 640 handle the 
second meeting. 

Line 560 starts the slow sprite 
moving, while line 570 deletes the 
fast sprite. Lines 580 through 630 
make the slow sprite walk 20 steps. 



>470 REM #1 HIT WALL 
>480 CALL MOTIOW(#1,0,C) 
>490 CALL P0SITI0N(#1,YP0S1,X 
P0S1) 

>500 CALL LOC ATE (#1,YPCS 1,193 

) 
>510 XDIR=XDIR+1 
>520 CALL MOTI0N(#l,0,XDIR) 
>530 GOIO 300 

>540 REM SECOND COINCIDENCE 
>550 FOR DELAY=1 TO 500 : : NE 

XT DELAY 
>560 CALL MOTICN(#2,0 J 4) 
>570 CALL DELSERITE(#i; 
>580 FOR STEP1=1 TO 20 
>590 CALL PATTERN (#2,100) 
>600 FOR DELAY=1 TO 20 : : NEX 

T DELAY 
>610 CALL PATTERN (#2 ,96) 
>620 FCR DELAY=1 TO 20 : : NEX 

T DELAY 
>630 NEXT STEP1 
>640 CALL CLEAR 



176 



TI Extended BASIC 



Tl Extended BASIC 



177 



SQR 



Format -- 

SQR [numeric-express ion) 

Description 

The SQR function returns the positive square rool of numeric-expression. 
SQRtX) is equivalent toXA(l/2). Numeric -expression may not be a negative 
number. 



Examples 

PRINT SQR(4) prints 2. 

X = SQR(2.57E5) sets X equal to the 
square root of 257,000 which is 
506.9516742. 



>100 PRINT SQR ( ^ ) 
>100 X=SQR(2.57E5) 



STOP 



Format 

STOP 

Description 

The STOP staiement stops program execution. It can be used 
interchangeably with the END statement except that it may not be placed 
after subprograms. 

Program 

The program on the right illustrates >100 CALL CLEAR 

the use of the STOP statement. The >110 TOT=0 

program adds the numbers from 1 to >120 NUMB=1 

100. >130 T0T=T0T+NUMB 

>l40 NUMB=NUMB+1 
>150 IF NUMB>1C0 THEN PRINT T 
OT: :ST0P 
>160 GOTO 130 



STR$ 



CHAPTER 



4 



Format 

| STR$t numeric-expression) 

,„. description 

^ The STR$ functon returns a string equivalent to numeric-expression. This 
■I allows the functions, statements, and commands that act on strings to be 
I used on the character representation of numer ^expression. The STR$ 
^function is the inverse of the VAL function. 



Examples 

^UM$ = STR$(78.6) sets NUMS equal 
ifco "78.6". 

LLS = STR$(3E 15) sets LL$ equal to 
[*'3.E15'\ 

|l$ = STRS(A*4) sets 1$ equal to a 
i string equal to what ever value is 
iobtalned when A is multiplied by 4. 
||ft>r instance, if A is equal to - 8, 1$ 
>set equal to *'-32 ,, . 



>100 NUM$=STR$(78.6) 



>100 LL$=STR$(3EL5) 



MOO I$=STR$(A*4) 



178 



TI Extended BASIC 



.i:' 



# TI Extended BASIC 



179 



^, 



SUB 



Format 

SUB subprogram-name [{parameter-list)} 
Description 

The SUB statement is the first statement in a subprogram. Subprograms are 
used when you wish to separate a group of statements from the main 
program. You may use subprograms to perform an operation several times in 
a program or in several different programs or to use variables that are 
specific to the subprogram. The SUB statement may no: be in an IF-THEN- 
ELSE statement. 

Subprograms are caKed with CALL subprogram-name {{parameter-list}}. 
Subprograms are ended with SUBEND, and lefl when either a SUBEND or a 
SUBEXIT statement is executed. Control is returned to :he statement 
following the statement that called the subprogram. You must never transfer 
control out of a subprogram with any statement except SUBEND or 
SUBEXIT. This includes passing control with ON ERROR. 

When a subprogram is in a program. It must follow the main program. The 
structure of a program must be as follows: 

Start of Main Program 



Subprogram Calls 



End of Main Program 
Start of First Subprogram 

End of First Subprogram 
Start of Second Subprogram 



The program will stop here without 
a STOP or END statement. 
Subprograms are optional. 



Nothing may appear between 
subprograms except remarks and 
the END statement. 



SUB 



CHAPTER 



4 



Options 

TVll variables used in a subprogram other than those in parameter-! is f are 
local to that subprogram, so you may use the same variable names that are 
used in the main program or in other subprograms, and alter their values, 
without having any effect on other variables. Likewise, the values of 
variables in the main program or other subprograms have no effect on the 
values of the variables in the subprogram. (However, DATA statements are 
■[available to subprograms,) 

■Communicating values to and from the main program is done with the 
'iOptional parameter -list. The parameters need not have the same names as in 

■the calling statement, but they must be of the same data t\pe (numeric or 
.-String) and in the same order as the items in the CALL. If simple variables 
passed to subprograms have their values changed in the subprogram, the 
lvalues of the variables in the main program are also changed. An array 
Jfelernent such as A(l) in the parameter list of the calling statement is also 
^Changed in value in the main program when control is returned to the main 
program. 

■Jk value: that is given in ihe calling statement as an expression is passed as a 

lvalue only and changes in the value in the subprogram do not change values 

the main program. Entire arrays are passed by reference, so changes in 

ements in the subprogram also change the values of the elements of the 

ray in the main program. Arrays are indicated by following the parameter 

|iame with parentheses. If the array has more than one dimension, a comma 

jfcnust be placed inside the parentheses for each additional dimension. 

(you wish, you may pass values only for simple variables by enclosing them 
i parentheses. Then the value can be used in the subprogram, but it is not 
iged in the return to the main program. For example. CALL SPRG1({A)) 
ses the value of A to a subprogram that starts SUB SPROl(X). and allows 
fiat value to be used in X, but does not change the value of A in the main 
program if the subprogram changes the value of X. 

'a subprogram is called more than once, any local variables used in the 
Subprogram retain those values from one call to the next. 



End of Second Subprogram 
End of Prcgram 



Only remarks and END may appear 
after the subprograms. 



180 



« 



TI Extended BASIC ^ Extended RASX 



181 



SUB 




Examples 

SUB MENy marks the beginning of a 
subprogram. No parameters are 
passed or returned. 

SUB MENU(COUNT\CHOICEJ marks 
the beginning of a subprogram. The 
variables COUNT and CHOICE may 
be used and/or have their values 
changed in the subprogram and 
returned to the variables in the same 
position in the calling statement. 

SUB PAYCHECK(DATE,Q,SSN, 
PAYRATE,TABLE(,)) marks the 
beginning of a subprogram. The 
variables DATE, Q, SSN, PAYRATE, 
and the array TABLE with two 
dimensions may be used and/or have 
their values changed in the 
subprogram and returned to the 
variables in the same position in the 
calling statement. 



MOO SUB MENU 



>100 SUB MENU (COUNT, CHOICE) 



>100 SUB PAYCHECK (DATE, Q, SSN, 
PAYRATE, TABLED)) 



CHAPTER 



4 



(Program 

The program on the right illustrates 
$fre use of SUB. The subprogram 
SlENU had been previously saved 
1th the merge option. It prints a 
[ienu and requests a choice. The 
nain program tells the subprogram 
many choices there are and 
Irhat the choices are. 1 1 then uses the 
tioice made in the subprogram to 
etermine whit program to run. 

cginning of subprogram MENU- 



llote that this R is not the same as 
iie R used in lines 100 and 1 10 in 
tie main program. 



>100 CALL MENU (5, R) 

>110 ON R GOTO 120,130,140,15 

0,160 
>120 RUN "DSK1 .PAYABLES" 
>130 RUN "DSK1. RECEIVE" 
>140 RUN "DSK1 .PAYROLL" 
>150 RUN "DSK1. INVENTORY" 
>160 RUN -DSK1. LEDGER" 
>170 DATA ACC01NTS PAYABLE, AC 

COUNTS RECEIVABLE, PAYROLL, IN 

VENT0RY, GENERAL LEDGER 
>10000 SUB MENU (COUNT, CHOICE) 
>10010 CALL CliAR 
>10020 IF C0UN1>22 THEN PRINT 
"TOO MANY ITEMS 11 : : CH0ICE= 

:: SUBEXIT 
>10030 RESTORE 
>10040 FOR R=l TO COUNT 
>10050 READ TEKP$ 
>10060 TEMP$=SEG$ (TEMPS, 1,25) 
>10070 DISPLAY AT(R, 1) :Rj TEMP 



>10080 NEXT R 

>10090 DISPLAY AT(R+1,1) : "YOU 

R CHOICE: 1" 
>10100 ACCEPT AT(R+l,i;)BEEP 

VALIDATE(DIGn)SIZE(-2):CH0I 

CE 
>10110 IF CH0ICE<1 OR CH0ICE> 

COUNT THEN 10100 
>10120 SUBEND 






182 



T[ Extended BASK 



: TI Extended BASIC 



183 



SUBEND 



Format 

SUBEND 

Description 

The SUBEND statement marks the end of a subprogram. When SUBEND is 
execuled, control is passed to the statement following the statement that 
called the subprogram. The SUBEND statement must always be the last 
statement in a subprogram. The SUBEND statement may not be in an IF- 
THEN ELSE statement. The only statements that may immediately follow a 
SUBEND statement are REM, END, or the SUB statement tor the next 
subprogram. 



SUBEXIT 



Format 

SUBEXIT 

Description 

The SUBEXIT statement allows leaving a subprogram before the end of the 
subprogram (indicated with SUBEND). When it is executed, control is passed 
to the statement following the statement that called the subprogram. The 
SUBEXIT statement need not be present in a subprogram. 



■ 



184 



TIE xl ended BASIC 



TAB 



CHAPTER 



4 



Format 

TAB( numeric- express f on ) 



Description 

' The TAB function specifies the starting position for the next print-item in a 
PRINT, PRINT... USING. DISPLAY, or DISPLAY. ..USING statement. If 

^ numeric-expression is greater than the length of a record for the device on 
which the prining is being done (for example; 28 for the screen, 32 for the 
thermal printer, the specified vaiue for a file on a diskette or cassette), then :t 
Is repeatedly reduced by the record length until it is between 1 and the 
record length. 

If the number of characters already printed on the current record is less than 
or equal to nuneric-expression, the next print item is printed beginning on 
the position indicated by numeric expression. If the number of characters 
: already printed on the current record is greater than the position indicated 
by numeric-expression, the nexl print-item is printed on Lie next record 

beginning in the position indicated by numeric-expression. 

i 

'The TAB function is treated as a print-item, so it must have a print separator 
(colon, semicolon, or comma) before and/ar after ii, The prnt separator 

\ before TAB is evaluated before the TAB function. Normally semicolons are 
used before and after TAB. 



Examples 

PRINT TAB(12);35 prints the 
number 35 at the twelfth position. 

PRINT 356:TA3(18);"NAME" prints 
356 at the beginning of the line and 
NAME at the eighteenth position of 
the line. 

PRINT "ABCDEFGHUKLM":TAB(5): 
"NOP" prints ABCDEFGHIJKLM at 
the beginning of the line and NOP at 

the fiflh positicn of the next line, 

DISPLAY AT(12.1):"NAME":TAB 
(15); "ADDRESS" displays NAME at 
the beginning of the twelfth line on 
the screen and ADDRESS at the 
fifteenth position on the twelfth line 
of the screen. 



>100 PRINT TAB(12);35 



>100 PRINT 356;7ABC18);"NAME' 



>100 PRINT -ABCDEFGHIJKLM" ;TA 
B(5)j"N0P" 



>100 DISPLAY ATi 12,1): "NAME"; 
TAB (15) \ "ADDRESS" 



TI Exrmdrd RA?tO 



185 



TAN 



Format 

TAIN {radian-express t on) 

Description 

The tangent function gives the trigonometric tangent of radian-expression. If 
the angle is in degrees, multiply the number of degrees by PI/180 to get the 
equivalent angle in radians. 



Program 

The program on the right gives the 
tangent of several angles. 



>100 A=. 7853981633973 

>110 B=26. 565051177 

>120 C=45*PI/180 

>130 PRINT TAN(A);TAN(B) 

>l40 PRINT TAN(B*PI/1S0) 

>150 PRINT TAN(C) 

>RUN 

1. 7.17470553 

.5 

1 



TRACE 



Format 

TRACE 

Description 

The TRACE command causes each line number to be displayed on the 
screen before the statements on that line are executed. This enables you to 
follow the course of a program as a debugging aid. The TRACE command 
may be used as a statement. The effect of the TRACE command is canceled 
when the NEW command or UNTRACE command or statement is performed. 



Example 

TRACE causes the computer Lo 
display a trace of the lines of a 
program on the screen, 



>TRAC2 
MOO TRACE 



NBREAK 



CHAPTER 



4 



jrmat 

4BREAK [lim-ltst] 
ascription 

ne UNBREAK command removes all breakpoints. It can optionally be set 
or only those in line-list, UNBREAK can be used as a statement. 

camples 

5REAK rerroves all breakpoints. MJNBREAK 

>420 UNBREAK 

iREAK IOC. 130 removes the MJNBREAK 100,130 

ikpoints from lines 100 and 130. >320 UNBREAK 100,130 



NTRACE 



format 

NTRACE 

escrlption 

le UNTRACE command removes the effect of the TRACE command. 
NTRACE can be used as a statement. 

cample 

VTRACE removes the effect of >UNTRACE 

^CE. >420 UNTRACE 



186 



TI Extended BASIC jTl Extended BASIC 



187 



VAL 



Format 

■*■ 

WAUstring expression) 

Description 

The VAL function returns the number equivalent to string-expression. This 
allows the functions, statements, and commands that act on numbers to bo 
used on string-expression. The VAL function is the inverse of the STRS 
function. 

Examples 

NUM = VAL("78.6") sets NUM equal >100 NUM*VAL("78.6") 

to 73.6. 



LL = VAL("3E15*) sets LL equal to 
3.E15. 



>100 LL=VAL("3E15") 



VCHAR 



Format 

CALL VCHAR(roa\cofumn. character-code [.repetition]) 

Description 

The VCHAR subprogram places a character anywhere on the display screen 
and optionally repeats it vertically. The character with the ASCII value of 
character-code is placed in the position described by tolu and column and Is 
repeated vertically repetition times. 

A value of 1 for row indicates the top cf the screen. A value of 24 is the 
bottom of the screen. A value of 1 for column indicates the left side of the 
screen. A value of 32 is the right side cf the screen. The screen can be 
thought of as a grid as shown below. 



188 



TI Extended BASIC 



VCHAR 



CHAPTER 



4 



i i 



COLUMNS 

4 1 H 10 12 14 16 18 20 22 24 26 28 Mi J2 

3 J 5 I 7 i v i ii | i.l \ 15 I 17 i IV I 21 i 23 i 25 I 27 \ >Q J M i 



-■ 1 — ■ . , . ,„ 

, „ . 

_ __ 

■ — — — — - — . — . 1 .^_^ 



1 
2 — 

3 
4~ 

5 

7 

ft— 

9 

lu- 
ll 

12 — 

m u 

14-* 
15 

16 — 

17 
IS- 

19 
20 — 

21 
22 — 

2.1 
24^ 



Examples 

?ALL VCHAR( 12. 16.33) places 
iharacter 33 (an exclamation point) 
ft row 12. column 16. 

iALL VCHARU l.ASCr:"),768) 
>laces an exclamation point in row 
, column 1, and repeats it 768 
Imes, which fills the screen. 

IALL VCHAR(RC.K.T) places the 
haracter with a:i ASCII code of K in 
ow R, column C and repeats it T 
imes. 



>100 CALL VCHAR (12, 16,33] 



>L00 CALL VCHAR(l,l,ASC("!"), 
768) 



>L00 CALL VCHAR(R,C,K,T) 



tl Extended BASIC 



189 



VERSION subprogram 



Format 

CALL VERSION! numeric -variable) 

Description 

The VERSION subprogram returns a value indicating the version of BASIC 
that is being used. TI Extended BASIC returns a value of 100. 

Example 

CALL VERSION(V) sets V equal to >100 CALL VERSION(V) 

100. 



190 



TI Extended BASIC 



Appendices 



:The following appendices give useful information concerning TI Ex ended 
BASIC. 

Appendix A: List of Illustrative Programs 

Appendix B; List of Commands Statements, and Functions 

Appendix C: ASCII Codes 

Appendix D: Musical Tone Frequencies 

Appendix E: Character Sets 

Appendix F: Pattern Identifier Conversion Table 

Appendix G: Color Codes 

Appendix H: High Resolution Color Combinations 

^Appendix I: Split Console Keyboard 

Appendix J: Character Codes for Split Keyboard 

Appendix K: Mathematical Functions 

Appendix L: Lst of Speech Words 

^Appendix M: Adding Suffixes to Speech Words 

Appendix N: E~ror Messages 



TI Extended BASIC 



191 



List of 

Illustrative Programs 



ELEMENT 








ILLUSTRATED 


LINES 


DESCRIPTION 


PAG 




44 


Codcbreaker Game 


27 


ACCEPT 


16 


Entry of 20 names 


48 


CALL 


8 


CLEAR and user written subroutine 


55 


CHAR 


12 


1 . Moving figure 


58 




7 


2. Resetting characters 


58 


CHRS 


4 


List of ASCII codes 


60 


CLEAR 


3 


(Simple example) 


61 




3 


(Simple example) 


61 


COINC 


10 


(Simple example) 


65 


COS 


6 


(Simple example) 


69 


DATA 


14 


(Simple example) 


71 


DELETE 


2 


(Simple example) 


74 


DISPLAY 


18 


Draw on screen 


78 


ERR 


5 


(Simple example) 


84 


FOR-TOSTEP 


11 


Design 


87 


GOSUB 


24 


Probability 


90 


GOTO 


8 


Add 1 through 100 


91 


IF-THEN-ELSE 


17 


Sequence numbers 


96 


IMAGE 


12 


(Simple example) 


99 




2 


(Simple example) 


100 


INPUT 


17 


Writes letter 


103 


INPUT (with files] 


12 


(Simple example) 


106 


JOYST 


5 


Moves sprite 


108 


KEY 


12 


Moves sprite 


109 


LINPUT 


6 


(Simple example) 


113 


LOCATE 


6 


(Simple example) 


116 


LOG 


8 


Log to any base 


117 



192 



TI Extended BASIC 



LIST OF ILLUSTRATIVE PROGRAMS 



APPENDIX 



ELEMENT 






■ILLUSTRATED LINES 


DESCRIPTION 


MAGNIFY 


17 


(Simple example) 


MERGE 


13 


Moves sprite 


MOTION 


8 


Moves sprite 


NEXT 


6 


(Simple example) 


NUMBER 


4 


(Simple example) 


ON BREAK 


11 


(Simple example) 


ON ERROR 


15 


(Simple example) 


ON. ..GOSUB 


20 


Choose with a menu 


ON.. .GOTO 


19 


Chocse with a menu 


ON WARNING 


8 


(Simple example) 


PATTERN 


18 


Rolling wheel 


POS 


8 


Breakup sentence 


PRINT 


7 


(Simple example) 


RANDOMIZE 


5 


(Simple example) 


R£C 


12 


(Simple example) 


RETURN (with GOSUB) 


18 


Figure interest 


RETURN (with ON ERROR) 


13 


Handle error 


RUN 


12 


Chocse with a menu 


SAY 


4 


(Simple example) 


SIN 


6 


(Simple example) 


SOUND 


4 


P lav first 13 notes 


SPGET 


4 


(Simple example) 


SPRITE 


8 


(Simple example) 




8 


Creation of stars 




55 


Walking sprites 


STOP 


7 


Add 1 through 100 


SUB 


21 


Choose with a menu 


TAN 


6 


(Simple example) 



A 



PAGE 

120 
122 
125 
127 
128 
130 
132 
134 
136 
137 
142 
145 
149 
151 
153 
157 
158 
162 
164 
168 
171 
172 
174 
175 
175 
178 
183 
186 



TI Extended HAS It: 



193 



Commands, Statements, 
and Functions 



The following is a list of all Tl Extended BASIC commands, statements, and 
functions. Commands are listed first; if a command can also be used as a 
stalement, the letter "S" Is listed to the right of the command. Commands 
that can be abbrevia.ed have the acceptable abbreviations underlined. Next 
is a list of all TI Extended BASIC statements; those that can also be used as 
commands have a "C" after them. Finally, there is a HsL of all Tl Extended 
BASIC fund ions. 



TI Extended BASIC Commands 



BREAK S 


MERGE 


SAVE 


BYE 


NUMBER 


SIZE 


CONTINUE 


OLD 


TRACE S 


DELETE S 


RESEQUENCE 


UNBREAK S 


LIST 


RUNS 


UNTRACES 




TI Extended BASIC Statements 


ACCEPT C 


CALL HCHAR C 


OPTION BASE 


CALL 


IF THEN ELSE 


CALL PATTERN C 


CALL CHAR C 


IMAGE 


CALL PEEK C 


CALL CHARPAT C 


CALL INIT C 


CALL POSITION C 


CALL CHARSET C 


INPUT 


PRINT C 


CALL CLEAR C 


INPUT REC 


PRINT USING C 


CLOSE C 


CALL JOYST C 


RANDOMIZE C 


CALL COINC C 


CALL KEY C 


READC 


CALL COLOR C 


[LET] C 


REM C 


DATA 


CALL LINK C 


RESTORE C 


DEF 


LINPUT 


RETURN 


CALL DELSPRITE C 


CALL LOAD C 


CALL SAY C 


DIMC 


CALL LOCATE C 


CALL SCREEN C 


DISPLAY C 


CALL MAGNIFY C 


CALL SOUND C 


DISPLAY USING C 


CALL MOTION C 


CALL SPGET C 


CALL DISTANCE C 


NEXTC 


CALL SPRITE C 


END 


ON BREAK 


STOP C 


CALL ERR C 


ON ERROR 


SUB 


FORC 


ON GOSUB 


SUBEND 


CALL GCHAR C 


ON GOTO 


SUBEXIT 


GOSUB 


ON WARNING 


CALL VCHAR C 


GOTO 


OPEN C 


CALL VERSION C 



COMMANDS, STATEMENTS, AND FUNCTIONS 



APPENDIX 



B 



ABS 

ASC 

ATN 

CHR$ 

COS 

EOF 

EXP 

INT 



TI Extended BASIC Functions 

LEN SEGS 

LOG SGN 

MAX SIN 

MIN SQR 

PI STRS 

POS TAB 

REC TAN 

RND VAL 
RPTS 



194 



TI Extended BASIL' 



| Tl Extended BASIC 



195 



ASCII Codes 



APPENDIX 



c 



The following predefined characters may be printed or displayed on the screen. 



ASCII 


**' 




ASCII 




CODE 




CHARACTER 


CODE 


CHARACTER 


30 




(cursor) 


63 


? (question mark) 


31 




(edge character) 


64 


@ (at sign) 


32 




(space) 


65 


A 


33 


i 


(exclamation point) 


66 


B 


34 


•* 


(quote) 


67 


C 


35 


# 


(number or pound sign) 


68 


D 


36 


S 


(dollar) 


69 


E 


37 


% (percent) 


70 


F 


38 


& 


(ampersand) 


71 


G 


39 


* 


(apostrophe) 


72 


H 


40 


( 


(open parenthesis) 


73 


I 


41 


) 


(close parenthesis) 


74 


J 


42 


9 


(asterisk) 


75 


K 


43 


+ 


(plus) 


76 


L 


44 


t 


(comma) 


77 


M 


45 


- 


(minus) 


78 


N 


46 


. 


(period) 


79 


O 


47 


/ 


(slash) 


80 


P 


48 







81 


9 


49 


1 




82 


R 


50 


2 




83 


S 


51 


3 




84 


T 


52 


4 




85 


U 


53 


5 




86 


V 


54 


6 




87 


w 


55 


7 




88 


X 


56 


8 




89 


Y 


57 


9 




90 


Z 


58 


: 


(cobn) 


91 


I (open bracket) 


59 


; 


(semicolon) 


92 


\ (reverse slash) 


60 


< 


(less than) 


93 


] (close bracket) 


61 


= 


(equals) 


94 


A (exponentiation) 


62 


> 


(greater than) 


95 


(underline) 


The following key presses may also be detected by CALL KEY. 


1 




SHIFT A (AID) 


3 


SHIFT F(DEL) 


4 




SHIFT G (INS) 


6 


SHIFT R (REDO) 


7 




SHIFT T (ERASE) 


8 


SHIFT S (LEFT ARROW) 


9 




SHIFT D (RIGHT ARROW) 


10 


SHIFT X (DOWN ARROW) 


11 




SHIFT E (UP ARROW) 


12 


SHIFT V (CMD) 


13 




ENTER 


14 


SHIFT W (BEGIN) 


15 




SHIFT Z (BACK) 







Musical Tone Frequencies 



APPENDIX 



D 



The following table gives the frequencies (rounded to integers) of four octaves 
of the tempered scale (one half step between notes). While this list docs noL 
represent the entire range of tones that the computer can produce, it can be 
helpful for programming music. 



FREQUENCE 


r NOTE 


FREQUENCY NOTE 


110 


A 
A**. B> 




440 


A labove middle C) 


117 




466 


A* , B> 


123 


B 




494 


B 


131 


C (lowC) 




523 


C (high C) 


139 


C* , D 7 




554 


C^ . D b 


147 


D 




587 


D 


156 


DP , E^ 




622 


D& , E y 


165 


E 




659 


E 


175 


F 




698 


F 


185 


F#, G h 




740 


F*, G* 


196 


G 




784 


G 


208 


G* , A" 




831 


G#, A^ 


220 


A (below 


middle C) 


880 


A (above high C) 


220 


Ajbeiow 
A* . B- 


middle C) 


880 


A (above high C) 


233 




932 


A*,B> 


247 


B 




988 


B 


262 


C (middle 


C) 


1047 


C 


277 


C* . D> 




1109 


C*, D> 


294 


D 




1175 


D 


311 


DJ* , E 1 




1245 


D* , E* 


330 


E 




1319 


E 


349 


F 




1397 


F 


370 


F# . G ? 




1480 


FP , G 1 * 


392 


G 




1568 


G 


415 


G$ . A? 




1661 


G*.A^ 


440 


A (above middle C) 


1760 


A 



196 



TI Extended BASIC 



Tt Extended BASIC 



197 



Character Sets 



APPENDIX 



E 



SET 

1 
2 
3 
4 
5 
6 
7 



ASCII CODES 
30-31 
32-39 
40-47 
48-55 
56-63 
64-71 
72-79 
80-87 



SET 

8 
9 

10 
11 
12 
13 
14 



ASCII CODES 

88-95 
96-103 
104-111 
112-119 
120-127 
128-135 
136-143 



Pattern-Identifier 
Conversion Table 



Blocks 



APPENDIX 



F 



BINARY CODE 


HEXADECIMAL 


(0 = off; 1 = 


on) 


CODE 


0000 







0001 




1 


0010 




2 


0011 




3 


0100 




4 


0101 




5 


0110 




6 


0111 




7 


1000 




8 


1001 




9 


1010 




A 


1011 




B 


1100 




C 


1101 




D 


1110 




E 


1111 




F 



Jolor Codes 



ApPEnM 



G 



198 



Tl Extended BASIC 



COLOR 
Transparent 
Black 

Medium Green 
Light Green 
Dark Blue 
Light Blue 
Dark Red 
Cyan 



CODE 


COLOR 


1 


Medium Red 


2 


Light Red 


3 


Dark Yellow 


4 


Light Yellow 


5 


Dark Green 


6 


Magenta 


7 


Gray 


8 


White 



CODE 
9 
10 
11 
12 
13 
14 
15 
16 



Tl Extended BASIC 



199 



Color Combinations 



APPENDIX 



The following color combinations produce the sharpest , clearest character 
resolution. 



H 



Iplit Console Keyboard 



APPENDIX 



I 



BEST 



2, 8 


Black on Cyan 


2, 13 


2, 7 


Black on Dark Red 


2, 15 


2, 6 


Black on Light Blue 


2. 14 


2, 3 


Black on Medium Green 


2. 9 


5. 8 


Dark Blue on Cyan 


5. 15 


5, 6 


Dark Blue on Light Blue 


5.4 


5. 14 


Dark Blue on Magenta 


5. 16 


13, 8 


Dark Green on Cvan 


13. 11 


13. 15 


Dark Green on Grav 


13. 4 


13. 12 


Dark Green on Light Yellow 


L3. 3 


7. 15 


Dark Red on Gray 


7. 10 


7, 12 


Dark Red on Light Yellow 


14. 2 


3, 12 


Medium Green on Lighl Yellow 


3, 15 




SECOND BEST 


2, 5 


Black on Dark Blue 


2. 11 


2. 4 


Black on Light Green 


2, 10 


2, 12 


Black on Light Yellow 


13, 10 


13. 16 


Dark Green on White 


7, 16 


6. 15 


Light Blue on Gray 


6. 4 


6, 16 


Light Blue on White 


4. 16 




THIRD BEST 


2. 16 


Black on White 


5. 12 


7. 9 


Dark Red on Medium Red 


4. 12 


14. 15 


Magenta on Gray 


14, 16 


3, 11 


Medium Green on Dark Yellow 


3, 15 


9. 15 


Medium Red on Gray 


9, 10 


9. 12 


Medium Red on Light Yellow 


9, 16 


16. 7 


White on Dark Red 






FOURTH BEST 


8. 2 


Cyan on Black 


6. 16 


7, 2 


Dark Red on Black 


7.4 


15. 16 


Gray on White 


5. 2 


4. 2 


Light Green on Black 


10. 2 


10. 16 


Light Red on Wliite 


14. 12 


9. 4 


Medium Red on Light Green 


16. 6 



Black on Dark Green 

Llaek on Gray 

fcilack on Magenta 

Back on Medium Red 

Dark Blue on Gray 

Dark Blue on Light Green 

Lark Blue on While 

Dark Green on Dark Yellow 

Lark Green on Light Green 

Dark Green on Medium Green 

Dark Red on Light RL-d 

Magenta on Light Red 

Medium Gteen on White 



Black on Dirk Yellow 
Black on Lighl Red 
Dark Greer on Light Red 
Dark Red on White 
Light Blue on Light Green 
Light Green on White 

Dark Blue on Light Yellow 
Light Green on Light Yellow 
Mage ma on White 
Medium Green on Gray 
Medium Red on Light Red 
Medium Red on White 



Cyan on White 
Dark Red on Light Green 
Light Blue on Black 
Light Red on Black 
Magenta on Light Yellow 
White on Light Blue 





jj 

': , , 1 , m □ aim b □ m a 

db ra m ± m 

14 13 J 16 15 

□□asms 

i SPACE BAR 



16 15 




Character Codes 
for Split Keyboard 



APPENDIX 



J 



CODE 


1 
2 
3 
4 
5 
6 
7 
8 
9 



KEYS* 
X. M 
A. H 
S.J 

D. K 

w. u 

E. I 
R, 

2, 7 

3, 8 

4, 9 



CODE 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 



KEYS* 

5.0 

T, P 

F, L 

V, ENT 

C, . 

Z. N 

SHIFT, B 

SPACE, G 

Q.Y 
1, 6 



*Note that the first key listed is on the left side of the keyboard and Ihe 
second key listed is on the right side of the keyboard. 



TI Extended BASIC 



201 



Mathematical Functions 



APPENDIX 



K 



The following mathematical functions may be defined with DEF as shown 



Function 
Secant 

Cosecant 
Cotangent 
Inverse Sine 
Inverse Cosine 
Inverse Sccanl 
Inverse Cosecant 
Inverse Cotangert 
Hyberbolic Sine 
Hyberbolic Cosine 
Hyperbolic Tangent 
Hyperbolic Secart 
Hyperbolic Cosecant 
Hyperbolic Cotangent 
Inverse Hyperbolic Sine 
Inverse Hyperbole Cosine 
Inverse Hyperbol c Tangent 
Inverse Hyperbole Secant 
Inverse Hyperbole Cosecant 
Inverse Hyperbole Cotangent 



TI Extended BASIC statement 

def sec(x)=1/c0s(x) 
def csc(x)=i/s:n(x} 

def c0t(x) = 1/tan(x} 

def af,csin(x)=atn(x/sqr[1-x*x)) 

def afcc0s(x)=-atn(x/sqr(l-x*x))<-pi/2 

DEF AECSEC(X)=ATN(SQR(X+X-l))+(S3N(X)-l)*PI/2 
DEF AFCCSC(X)=ATN{l/SQRlX*X-l))+(SGN(X)-l)*PI/2 
DEF AfiCC0T(X)=PI/2-ATN(X) or =PI/2+ATN(-X) 

def sinh(x)=(exp(x)-exp:-x))/2 

def ccsh(x)=(e):p(x)+exp:-x))/2 

def tanh(x)=-2*exp(-x)/;exp(x)+exp(-x))+1 

def sech=2/(exp(x)+exp(-x}) 

def csch=2/(ex?(x)-exp(-x)) 

def ccth(x)=2*exp(-x)/(exp(x)-exp(-x))+1 

def arcsinh(x)=l0g(x+sqr(x*x+1)) 

DEF AflCCQSH(X)=LOG(X+SQR(X*X-l)) 

DEF ARCTANH(X)=L0G((l+X)/(l-X))/2 

DEF ARCSECH(X)=LOG( (1+SQR(1-X*X))/X) 

DEF APCCSCH(X)=LOG( (SGNiX)*SQR(X*X+l}+l}/X) 

DEFAFCC0TH(X)=LOG({X+lj/(X-l)}/2 



202 



TI Extended BASIC 



List of Speech Words 



APPENDIX 



L 



The following is a list of all the letters, numbers, words, and phrases that can 
be accessed w:th CALL SAY and CALL SPGET. See Appendix M for 
instructions on adding suffixes to anything in this list. 

F 

FIFTEEN 

FIFTY 

FIGURE 

FIND 

FINE 

FINISH 

FINISHED 

FIRST 

FIT 

FIVE 

FOR 

FORTY 

FOUR 

FOURTEEN 

FOURTH 

FROM 

FRONT 

G 

GAMES 

GET 

GETTING 

GIVE 

GIVES 

GO 

GOES 

GOING 

GOOD 

GOOD WORK 

GOODBYE 

GOT 

GRAY 

GREEN 

GUESS 

H 

HAD 

HAND 

HANDHELD UNIT 

HAS 

HAVE 

HEAD 

HEAR 

HELLO 

HELP 



- (NEGATIVE) 


CENTER 


+ (POSITIVE) 


CHECK 


. (POINT) 


CHOICE 





CLEAR 


1 


COLOR 


2 


COME 


3 


COMES 


4 


COMMA 


5 


COMMAND 


6 


COMPLETE 


7 


COMPLETED 


8 


COMPUTER 


9 


CONNECTED 


A (a) 
Al (3) 
ABOUT 
AFTER 


CONSOLE 
CORRECT 
COURSE 
CYAN 


AGAIN 


D 


ALL 


DATA 


AM 


DECIDE 


AN 


DEVICE 


AND 


DID 


ANSWER 


DIFFERENT 


ANY 


DISKETTE 


ARE 


DO 


AS 


DOES 


ASSUME 


DOING 


AT 


DONE 


B 


DOUBLE 


BACK 
BASE 
BE 


DOWN 
DRAW 
DRAWING 


BETWEEN 


E 


BLACK 


EACH 


BLUE 


EIGHT 


BOTH 


EIGHTY 


BOTTOM 


ELEVEN 


BUT 


ELSE 


BUY 


END 


BY 


ENDS 


BYE 


ENTER 


C 


ERROR 


CAN 


EXACTLY 


CASSETTE 


EYE 



TI Extended BASIC 



203 



APPENDIX 



LIST OF SPEECH WORDS 



LIST OF SPEECH WORDS 



HERE 

HIGHER 

HIT 

HOME 

HOW 

HUNDRED 

HURRY 

I 

I WIN 

IF 

IN 

INCH 

INCHES 

INSTRUCTION 

INSTRUCTIONS 

IS 

IT 

J 

JOYSTICK 

JUST 

K 

KEY 

KEYBOARD 

KNOW 

L 

LARGE 

LARGER 

LARGEST 

LAST 

LEARN 

LEFT 

LESS 

LET 

LIKE 

LIKES 

LINE 

LOAD 

LONG 

LOOK 

LOOKS 

LOWER 

M 

MADE 

MAGENTA 

MAKE 

ME 

MEAN 



MEMORY 

MESSAGE 

MESSAGES 

MIDDLE 

MIGHT 

MODULE 

MORE 

MOST 

MOVE 

MUST 

N 

NAME 

NEAR 

NEED 

NEGATIVE 

NEXT 

NICE TRY 

NINE 

NINETY 

NO 

NOT 

NOW 

NUMBER 

O 
OF 
OFF 
OH 

ON 

ONE 

ONLY 

OR 

ORDER 

OTHER 

OUT 

OVER 

P 

PART 

PARTNER 

PARTS 

PERIOD 

PLAY 

PLAYS 

PLEASE 

POINT 

POSITION 

POSITIVE 

PRESS 

PRINT 



PRINTER 

PROBLEM 

PROBLEMS 

PROGRAM 

PUT 

PUTTING 

9 

R 

RANDOMLY 

READ [read] 

READ1 (red) 

READY TO START 

RECORDER 

RED 

REFER 

REMEMBER 

RETURN 

REWIND 

RIGHT 

ROUND 

S 

SAID 

SAVE 

SAY 

SAYS 

SCREEN 

SECOND 

SEE 

SEES 

SET 

SEVEN 

SEVENTY 

SHAPE 

SHAPES 

SHIFT 

SHORT 

SHORTER 

SHOULD 

SIDE 

SIDES 

SIX 

SIXTY 

SMALL 

SMALLER 

SMALLEST 

SO 

SOME 

SORRY 



L 



204 



T1 Extended BASK: 



SPACE 

SPACES 

SPELL 

SQUARE 

START 

STEP 

STOP 

SUM 

SUPPOSED 

SUPPOSED TO 

SURE 

T 

TAKE 

TEEN 

TELL 

TEN 

TEXAS INSTRUMENTS 

THAN 

THAT 

THAT IS INCORRECT 

THAT IS RIGHT 

THE (the] 

THE1 (tho) 

THEIR 

THEN 

THERE 

THESE 

THEY 

THING 

THINGS 

THINK 

THIRD 

THIRTEEN 

THIRTY 

THIS 

THREE 

THREW 

THROUGH 

TIME 

TO 

TOGETHER 

TONE 

TOO 

TOP 

TRY 

TRY AGAIN 

TURN 

TWELVE 



TWENTY 

TWO 

TYPE 

U 

UHOH 

UNDER 

UNDERSTAND 

UNTIL 

UP 

UPPER 

USE 

V 

VARY 

VERY 

W 

WAIT 

WANT 

WANTS 

WAY 

WE 

WEIGH 

WEIGHT 

WELL 

WERE 

WHAT 

WHAT WAS THAT 

WHEN 

WHERE 

WHICH 

WHITE 

WHO 

WHY 

WILL 

WITH 

WOM 

WORD 

WORDS 

WORK 

WORKING 

WRITE 

X 
Y 

YELLOW 

YE5 

YET 

YOU 

YOU WIN 

YOUR 



Z 

ZERO 



TI Extended BASIC 



205 



Adding Suffixes 
to Speech Words 



This appendix describes how to add ING S. and ED to any word available in 
the Sclid*State Speech™ Synthesizer resident vocabulary. 

The code for a word is first read using SPGET. The code consists of a 
number of characters, one of which tells the speech unit the length of the 
word. Then, by means of the subprograms listed here, additional codes can 
be added to give the sound of a suffix. 

Words often have trailing-off data that make the word sound more natural 
but prevent the easy addition of suffixes. In order to add suffixes this trailing- 
off data must be removed. 

The following program allows you to input a word and. by trying different 
truncation values, make the suffix sound like a natural part of the word. The 
subprograms DEFING {lines 1000 through 1 130), DEFS1 (lines 2000 through 
2100). DEFS2 (lines 3000 through 3090). DEFS3 (lines 4000 through 4120). 
DEFED1 (lines 5000 through 5070), DEFED2 (lines 6000 through 61 10), 
DEFED3 (lines 7000 through 7130), and MENU (lines 10000 through 10120) 
should be Input separately and saved with the MERGE option. (The 
subprogram MENU is the same one used in the illustrative program with 
SUB.) You may wish to use different line numbers. Each of these 
subprograms (except MENU) defines a suffix. 

DEFING defines the ING sound. DEFS1 defines the S sound as it occurs at 
the end of "cats." DEFS2 defines the S sound as ii occurs at the end of 
"cads." DEFS3 defines the S sound as it occurs at the end of "wishes." 
DEFED1 defines the ED sound as it occurs at the end of "passed." DEFED2 
defines the ED sound as it occurs at the end of "caused." DEFED3 defines 
the EE sound as it occurs at the end of "heated." 

In running the program, enter a for the truncation value In order to leave 
the truncation sequence. 

100 REM ******************* 

110 REM REQUIRES MERGE OF: 

120 REM MENU (LINES 10000 THROUGH 10120) 

130 REM DEFING (LINES 1000 THROUGH 1130) 

140 REM DEFS1 (LINES 2000 THROUGH 2100) 

150 REM DEFS2 (LINES jOOO THROUGH 3Q9Q) 

160 REM DEFS3 (LINES 4000 THROUGH 4120) 

170 REM DEFED1 (LINES 5000 THROUGH 50^0) 

180 REM DEFED2 (LINES 6000 THP.0UGH 6U0) 

190 REM DEFED3 (LINES 7000 THROUGH 71 JO) 

200 RE*! ******************* 

210 CALL CLEAR 

220 PRrNT "THIS PROGRAM IS USED TO" 



206 



TI Extended BASIC 



ADDING SUFFIXES TO SPEECH WORDS 



APPENDIX 



M 



230 PRINT "FIND THE PROPER TRUNCATION" 

240 PRINT "VALUE FOR ADDING SUFFIXES" 

250 PRINT "TO SPEECH WORDS/': : 

260 FOR DELAY=1 TO 300: :NEXT DELAY 

270 PRINT "CHOOSE WHICH SUFFIX YOU" 

280 PRINT "WISH TO ADD.": : 

290 FOR DELAY* 1 TO 200: :NEXT DELAY 

300 CALL MENU( 8, CHOICE) 

310 DATA 'INGVS' AS IN CATS, 'S 1 AS IN CADS,'S' AS IN WISHES, 

'ED' AS IN PA3SED,'ED 1 AS IN CAUSED, ED' AS IN HEATE3,END 

320 IF CHOICER OR CHOICER THEN STOP 

330 INPUT "WH&T IS THE WORD? ":U0RD$ 

340 ON CHOICE GOTO 350,370,390,410,430,450,470 

350 CALL DEFING (D$) 

360 GOTO 480 

370 C4LL DEFS1(D$)!CATS 

380 GOTO 480 

390 CALL DEFS2(D$)tCADS 

400 GOTO 480 

410 CALL DEF£3(D$) SWISHES 

420 GOTO 480 

430 CALL DEFED1(D$)!PASSED 

440 GOTO 480 

450 CALL DEFED2(D$)! CAUSED 

460 GOTO 480 

470 CALL DEFED3(D$)! HEATED 

480 REM TRY VALUES 

490 CALL CLEAR 

500 INPUT "TEUNCATE HOW MANY BYTES? ":L 

510 IF L=0 THEN 300 

520 CALL SPGET (W0RD$,B$) 

530 L=LEN(B$;-L-3 

540 C$*SEG$(B$,1,2)&CHR$(L)&SEG$(B$,4,L) 

550 CALL SAY;,C$&D$) 

560 GOTO 500 



TI Extended BASIC 



207 



ADDING SUFFIXES TO SPEECH WORDS 



The data has been given in short DATA statements to make it as easy as 
possible jo input. It may be consolidated to make the program shorter. 

1000 SUB DEF1NG(A$) 

1010 DATA 96,0,52,174,30,65 

1020 DATA 21,186,90,247,122,214 

1030 DATA 179,95,77,13,202,50 

1040 DATA 153,120,117,57,40,248 

1050 DATA 133,173,209,25,39,85 

1060 DATA 225,54,75,167,29,77 

1070 DATA 105,91,44,157,118,180 

1080 DATA 169,97,161,117,218.25 

1090 DATA 119,184,227,222,249,238,1 

1100 RESTORE 1010 

1110 &$ = "" 

1120 FOR 1=1 TO 55::EEAD A: :A$=A$&CHR$(A) : ;NiXT I 

1130 SUBEND 

2000 SUB DEFS1(A$)!CATS 

2010 DATA 96,0,26 

2020 DATA 14,56,130,204,0 

2030 DATA 223,177,26,224,103 

2040 DATA 85,3,252,106,106 

2050 DATA 128,95,44,4,240 

2060 DATA 35, U, 2, 126,16, 121 

2070 RESTORE 2010 

2080 A$ = — 

2090 FOR 1=1 TO 29::READ A: ;A$=A$&CHH$(A) : :NEXT I 

2100 SUBEND 

3000 SUB DEFS2(A$)!CADS 

3010 DATA 96,0,17 

3020 DATA 161,253,158,217 

3030 DATA 168,213,198,86,0 

3040 LATA 223,153,75,128,0 

3050 DATA 95,139,62 

3060 RESTORE 3010 

3070 A$="" 

3080 FOR 1=1 10 20;:READ A: :j 

3090 SUBEND 



&=A$&CHR$(A): :NEXT I 



208 



TI Extended BASIC 



APPENDIX 



ADDING SUFFIXES TO SPEECH WORDS 



M 



4000 3UB DEFS3(A$)1 WISHES 

4010 DATA 96,0,34 

4020 DATA 173,233,33,84,12 

4030 DATA 242,205,166,55,173 

4040 DATA 93,222,68,197,188 

4050 DATA 134,238,123,102 

4060 DATA 163,86,27,59,1,124 

4070 DATA 103,46,1,2,124,45 

4080 DATA 135,129,7 

4090 RESTORE 4010 

4100 A$=-" 

4110 FOR 1=1 TO 37::READ A : : A$^A$&CHR$( A) 

4120 SUBEND 



:NEXT I 



5000 SU3 DEFED1(A$)! PASSED 

5010 DATA 96,0,10 

5020 DATA 0,224,128,37 

5030 DATA 20^,37,240,0,0,0 

5040 RESTORE 5010 

5050 A$= '" 

5060 FOR 1=1 TO 13::READ A: :k$=A$&CHR$(A) : :NEXT I 

5070 SUBEND 

6000 SUB DEF£D2(A$)! CAUSED 

6010 DATA 96.0,26 

6020 DATA 172, 163,214 , 59,35 

6030 DATA 109,170,174,68,21 

6040 DATA 22,201,220,250,24 

6050 DATA 69,148,162,166,234 

6060 DATA 75,64,97,145,204 

6070 DATA 15 

6080 RESTORE 6010 

6090 AS="" 

6100 FOR 1=1 TO 29::READ A: :A$=A$&CHR$(A) : :NEXT I 

6110 SUBEND 



TI Extended BASIC 



209 



ADDING SUFFIXES TO SPEECH WORDS 



7000 SUB DEFED3(A$)l HEATED 

7010 D4JTA 96,0,36 

7020 DATA 173,233,33,84,12 

7030 DATA 242,205,166,183 

7040 DATA 172,163,214,59,35 

7050 DATA 109,170,174,68,21 

7060 DATA 22,201,92,250,24 

7070 DATA 69,148,162,38,235 

7080 DATA 75,84,97,145,204 

7090 DATA 178,127 

7100 RESTORE 7010 

7110 A$="" 

7120 FOR 1=1 TO 39: :READ A: :A$=A$&CHR$(A) : :NEXT I 

7130 SUBEND 

10000 SUB MEVU( COUNT, CHOICE) 

10010 CALL CLEAR 

10020 IF C0UMT>22 THEN PRINT "TOO MANY ITEMS" :: CHDICE=0 ; 

10030 RESTORE 

10040 FOR 1=1 TO COUNT 

1005Q READ T£MP$ 

10060 TEHP$=SEG$ (TEMPI, 1,25) 

10070 DISPLAY AT(I,1):I;TEMP$ 

10080 NEXT I 

10090 DISPLAY AT(I+l,l) : "YOUR CHOICE: 1" 

10100 ACCEPT AT (1+1,14) BEEP VALIDATE(DIGIT)SIZE(-2) rCHOICE 

10110 IF CH0ICE<1 OR CHOICE>COUNT THEN 10100 

10120 SUBEND 



SUBEXIT 



210 



[ADDING SUFFIXES TO SPEECH WORDS 



APPENDIX 



Tl Extended BASIC 



M 



[You can use the subprograms in any program once you have determined the 
I number of bytes to truncate. The following program uses :he subprogram 
DEFING in lines lOOO through 1130 to have the computer say the word 
[DRAWING using DRAW plus the suffix ING. Note that it was found that 
[:DRAW should be truncated by 41 characters to produce the most natural 
[sounding DRAWING. The subprogram DEFING in lines 10OO through 1 130 
f is the program you saved with the merge option. 

[100 CALL DEFING (ING$) 

110 CALL SPGET( "DRAW, DRAWS) 

120 L=LEN(DRAW$)-3-4l! 3 BYTES OF SP2ECH OVERHEAD, 41 BYTES TRUNCATED 
jl30 DRAtf$=SEC$(DRAW$,l,2)&CHR$(L)&SEG$(DRAW$,4,L) 
[140 CALL SAY("WE ARE' ,DRAV$&1NG$,-'A1 SCREEN") 

150 GOTO 140 

1000 SUB DEFING (A$) 
[1010 DATA 96,0,52,174,30,65 
[1020 DATA 21,186,90,247,122,214 
J1030 DATA 17^,95, 77, 13, 202, 50 

1040 DATA 15:, 120, 117, 57, 40, 248 
| 1050 DATA 13;, 173,209,25,39, 35 
I 1060 DATA 225,54,75,167,29,77 
j 1070 DATA 105,91,44,157, 118,180 
11080 DATA 169,97,161,117,218,25 
1 1090 DATA 119,184,227,222,249,238,1 
I 1100 RESTORE 1010 
ElllO A$=- 

[1120 FOR 1=1 TO 55::READ A: :&$=A$&CHR$(A) : :NEXT I 
J 1130 SUBEND 

(Press SHIFT C to stop the program.) 



TI Extended B^SIC 



211 



Errors 



■ 



The following lists all Lhe error messages that TI Extended BASIC gives. The 
first listis alphabetical by the message that is given, arid the second list is 
numeric by the number of the error that is returned by CALL ERR. If the 
error occurs in the execution of a program, the error message is often 
followed by IN line-number. 

Sorted by Message 
# Message Descriptions of Possible Errors 
74 BAD ARGUMENT 

* Bad value given in ASC. ATN, COS, EXP, INT, LOG, 
SIN f SOUND, SQK, TAN, or VAL. 

' An array element specified in a SUB statement. 

* Bad first parameter or too many parameters in LINK 
61 BAD LINE NUMBER 

* Line number less than 1 or greater than 32767. 

* Omitted line number. 

* Line number outside the range 1 through 32767 
produced by RES. 

57 BAD SUBSCRIPT 

* Use of too large or small subscript in an array, 

* Incorrect subscript in DIM. 

79 BAD VALUE 

* Incorrect value given in AND, CHAR, CHR$. CLOSE, 
EOF, FOR, GOSUB. GOTO. HCHAR INPUT. MOTION, 
NOT, OR, POS, PRINT, PRINT USING, REC. RESTORE, 
RPTS. SEGS, SIZE. VCHAR, or XOR. 

* Array subscript value greater than 32767. 

* File number greater than 255 or less than zero. 

* More than three tones and one noise generator specified 
in SOUND. 

* A value passed to a subprogram is not acceptable in Lhe 
subprogram. For example, a sprite velocity value less 
than - 128 or a character value greater than 143. 

* Value in ON. ..GOTO or ON ..GOSUB greater than the 
number of lines gu r en. 

* Incorrect position given after the AT e la use in ACCEPT 
or DISPLAY. 

67 CANT CONTINUE 

* Program has been edited after being stopped by a 
breakpoint. 

* Program was not stopped by a breakpoint. 
69 COMMAND ILLEGAL IN PROGRAM 

* BYE, CON. LIST. MERGE. MEW, NUM. OLD, RES, or 
SAVE used in a program. 



ERRORS 



84 DATA ERROR 



APPENDIX 



N 



READ or RESTORE with data not present or with a 

string where a numeric value is expected. 

Line number after RESTORE is higher (ban the highest 

line number in the program. 

Error in object file in LOAD. 



109 FILE ERROR 



212 



TI Extended BASIC 



* Wrong type of data read witn a READ statement. 

* Attempt to use CLOSE, EOF. INPUT, OPEN, PRINT. 
PRINT USING, REC, ur RESTORE with a file that does 
not exist or does not have the proper attributes. 

* Not enough memory to use a file, 

44 FOR-NEXT NESTING 

* The FOR and NEXT statements of loops do not align 
properly. 

* Missing NEXT statement. 

130 I/O ERROR 

* An error was detected in trying to execute CLOSE. 
DELETE, LOAD. MERGE. OLD, OPEV. RUN. or SAVE 

* Not enough memory to list a program. 

16 ILLEGAL AFTER SUBPROGRAM 

* Anything hut END, REM. or SUB afler a SUBEND. 

5 36 IMAGE ERROR 

* An error was deteeied in the use of DISPLAY USING. 
IMAGE, or PRINT USING. 

* More than 10 (E-format) or 14 (numeric format) 
significant digits in the format string. 

* IMAGE string is longer than 254 characters. 

28 IMPROPERLY USED NAME 

* Am illegal variable name was used in CALL, DEE, or 
DIM. 

* Using a TI Extended BASIC reserved word in LET. 

* Using a subscripted variable or a string variable in a 
FOR. 

* Using an array with the wreng number of dimensions. 

* Using a variable name differently thai originally 
assigned. A variable can be only an array, a numeric or 
string variable, or a user defined function name. 

* Dimensioning an array twice. 

* Putting a user defined function name on the left of the 
equals sign in an assignment statement. 

* Using the same variable twire in the parameter list of a 
SUB statemtent. 



TI Extended BASIC 



213 



ERRORS 



81 INCORRECT ARGUMENT LIST 

* * CALL and SUB mismatch of arguments. 

83 INPUT ERROR 

* An error was detected in an INPUT. 

60 LINE NOT FOUND 

* Incorrect line number found in BREAK. GOSUB, GOTO. 
ON ERROK. RUN, or UNBREAK. or after THEM or 
ELSE. 

* Line to be edited not found. 
62 LINE TOO LONG 

* Line too long to be entered into a program. 

39 MEMORY FULL 

* Program too large to execute one of the following: DEF, 
DELETE. DIM, GOSUB, LET. LOAD, ON. ..GOSUB. 
OPEN, or SUB. 

* Program too large to add a new line, insert a line, 
replace a line, or evaluate an expression. 

49 MISSING SUBEND 

* SUBEND missing in a subprogram. 
47 MUST BE IN SUBPROGRAM 

* SUBEND or SUBEXIT not in a subprogram. 
19 NAME TOO LONG 

* More than 1 5 characters in variable or subprogram 
name. 

43 MEXT WITHOUT FOR 

* FOR statement missing. NEXT before FOR, incorrect 
FOR-NEXT nesting, or branching into a FOR-NEXT 
loop. 

78 NO PROGRAM PRESENT 

* No program present when issuing a LIST. 
RESEQUENCE. RESTORE, RUN, or SAVE command. 

10 NUMERIC OVERFLOW 

* A number too large or too small resulting from a * . + . 
-, / operation or in ACCEPT. ATN, COS, EXP, INPUT, 
INT, LOG. SIN, SQR. TAN, or VAL. 

* A number outside the range -32768 to 32767 in PEEK 
or LOAD. 

70 ONLY LEGAL IN A PROGRAM 

* One of the following statements was used as a 
command: DEF, GOSUB, GOTO. IF, IMAGE, INPUT, ON 
BREAK, ON ERROR, ON. ..GOSUB. ON. ..GOTO, ON 
WARNING. OPTION BASE. RETURN. SUB, SUBEND, or 
SUBEXIT 



ERRORS 



APPENDIX 



214 



TI Extended BASIC 



N 



25 OPTION BASE ERROR 

* OPTION BASE executed more than once, or with a 
value other than 1 or zero. 

97 PROTECTION VIOLATION 

* Attempt to save, list, or edit a protected program. 

48 RECURSIVE SUBPROGRAM CALL 

* Subprogram calls itself, directly or indirectly. 
51 RETURN WITHOUT GOSUB 

* RETURN without a GOSUB or an error handled by the 
previous execution of an ON ERROR statement. 

56 SPEECH STRING TOO LONG 

* Speech string returned by SPGET is longer than 255 
characters. 

40 STACK OVERFLOW 

* Too many sets of parentheses. 

* Not enough memory to evaluate an expression or assign 
a value. 

54 STRING TRUNCATED 

* A string created by RPTS, concatenation ("&" operator), 
or a user defined function is longer than 255 characters. 

* The length of a string expression in the VALIDATE 
clause is greater than 254 characters. 

24 STRING-NUMBER MISMATCH 

* A siring was given where a number was expected or 
vice versa in a TI Extended BASIC supplied function or 
subprogram. 

* Assigning a string value to a numeric value or vice 
versa. 

* Attempting to concatenate ("&" operator) a number. 

* Using a string as a subscript. 
135 SUBPROGRAM NOT FOUND 

* A subprogram called does not exist or an assembly 
language subprogram named in LINK has not been 
leaded. 



TI Extended BA^IC 



215 



ERRORS 



14 SYNTAX ERROR 

* An error such as a missing or extra comma or 
parenthesis, parameters in the wrong order, missing 
parameters, missing keyword, misspelled keyword, 
keyword ir, the wrong order, or the like was detected in 
a TI Extended BASIC command, statement, function, or 
■subprogram. 

* DATA or IMAGE net first and only statement on a line. 

* Items after final ")". 

* Missing "#" in SPRITE. 

* Missing ENTER, tail comment symbol (!). or statement 
separator symbol (;:). 

* Missing THEN after IF. 

* Missing TO after FOR. 

* Nothing afier CALL, SUB, FOR. THEM, or ELSE. 

* Two E's in a numeric constant. 

* Wrong parameter list in a Tl Extended BASIC supplied 
subprogram. 

* Going into or out of a subprogram with GOTO, GOSUB. 
ON ERROR, etc. 

* Calling INIT without the Memory Expansion peripheral 
attached. 

* Calling LINK or LOAD withcut first calling INIT. 

* Using a constant where a variable is required. 

* More than seven dimensions in an array. 
17 UNMATCHED QUOTES 

* Odd number of quotes in an input line. 
20 UNRECOGNIZED CHARACTER 

* An unrecognized character such as ? or % is not in a 
quoted siring. 

* A bad field in an object file accessed by LOAD. 



216 



TI Extended BASIC 



ERRORS 



APPENDIX 



N 



Sorted by # 



# Message 

10 NUMERIC OVERFLOW 

14 SYNTAX ERROR 

16 ILLEGAL AFTER SUBPROGRAM 

17 UNMATCHED QUOTES 

19 NAME TOO LONG 

20 UNRECOGNI2ED CHARACTER 

24 STRING-NUMBER MISMATCH 

25 OPTION EASE ERROR 

28 IMPROPERLY USED NAME 

36 IMAGE ERROR 

39 MEMORY FULL 

40 STACK OVERFLOW 

43 NEXT WITHOUT FOR 

44 FORNEXT NESTING 

47 MUST BE IN SUBPROGRAM 

48 RECURSIVE SUBPROGRAM CALL 

49 MISSING SUBEND 

51 RETURN WITHOUT GOSUB 

54 STRING TRUNCATED 

I 56 SPEECH STRING TOO LONG 

57 BAD SUBSCRIPT 

60 LINE NOT FOUND 

61 BAD LINE NUMBER 

62 LINE TOO LONG 
67 CAN'T CONTINUE 

69 COMMAND ILLEGAL IN PROGRAM 

70 ONLY LEGAL IN A PROGRAM 
74 BAD ARGUMENT 

78 NO PROGRAM PRESENT 

79 BAD VALUE 

81 INCORRECT ARGUMENT LIST 

83 INPUT ERROR 

84 DATA ERROR 

97 PROTECTION VIOLATION 

109 FILE ERROR 

130 I/O ERROR 

135 SUBPROGRAM NOT FOUND 



TI Extended BASIC 



2 17 



Index 



The pagesjisted in italics show where the 
illustrative program. 

A 

Absolute value function (ABS) 20, 46 

ACCEFT statement ... 17,47-49.28,30. 

31.32, 48, 134, 136, 183 

Addition 41 

ALL, ERASE clause 47, 77 

Ampersand operator .41 

AND logical operator 42, 1 75 

APPEND clause 138 

Arctangent function (ATN) 20.51 

Arithmetic expressions 41 

Arithmetic hierarchy ... 41 

Arithmetic operators 41 

Arrays 76 

ASCII character codes 195 

ASCII function (ASC) 20. 50 

Assignment statement (LET) .... 17. 111. 

30, 55, 58. 65, 69. 78, 87, 90. 91 , 96, 99. 

113, 116, 117. 122. 127, 128. 132. 142. 

145, 157, 158. 168, 171, 175. 176. 178. 

183, 186 
AT clause 44, 77 

B 

Backspace key 12 

BASE, OPTION sLatement 141 

BEEP clause 47.77 

Binary codes . .43-44 

Blank spaces 39 

Branches, program . See GOTO. GOSUB, 
ON. .GOTO.ON. . GOSUB 

BREAK command 16. 26. 52, J 30 

Break key 13 

Breakpoints 16. 26, 52 

Built-in functions 20 

Built in subprograms 21 

BYE command 17, 54 

C 

CALL CHAR subprogram . . 22, 25, 56, 58, 

65, 120. 122, 142, 174. 175 
CALL CHARPAT subprogram 18, 23. 59 

CALL CHARSET subprogram 23,60 

CALL CLEAR subprogram . . .21.61,49. 
55. 58. 60. 6! , 65, 78, 87, 90, 96. 99, 
103. 106, 108. 109, 116, 117, 120. 122, 
125. 130, 132, 134. 136, 137, 142, 145, 
149. 151, 153, 157. 156. 162, 174, 175, 
177. 178. 183 
CALL COINC subprogram . 18. 22, 25. 65, 

176 
CALL COLOR subprogram . . .19.21.22, 
25, 66, 58, 78, 142. 1 75. 1 76 



language elements arc used in an 

CALL DELSPRITE subprogram 22. 

25, 75. 177 
CALL DISTANCE subprogram. .... 18. 22. 

25.80 
CALL ERR subprogram ... 18. 23. 26, 83, 

84. 132 

CALL GCHAR subprogram 18. 21.68 

CALL HCHAR subprogram . ... 19, 21. 92, 

58. 142, 175 

CALL I NIT subprogram 22, 101 

CALL JO YST subprogram . . . . 18, 21. 108 
CALL KEY subprogram . . . 18. 21. 78, 109 

CALL LINK subprogram 22. 112 

CALL LOAD subprogram 22. 115 

CALL LOCATE subprogram ... 18. 22. 25. 

J J6, 176, 177 
CALL MAGNIFY subprogram 22. 25. 

118, 120. 142, 176 
CALL MOTION subprogram . . 22, 25. 125. 

176, 177, 108, 109, 122, 125, 176. 177 
CALL PATTERN subprogram ... 22, 25. 

142, J 16, 177 

CALL PEEK Subprogram 22. 143 

CALL POSITION subprogram 22.25. 

146, 176, 177 
CALL SAY subprogram . . 19, 22. 24. 1 54. 

172 
CALL SCREEN subprogram . , 19. 21, 25, 

165, 84. 175 
CALL SOUND subprogram 19. 22, 

24, 172, 171 
CALL SPGET subprogram 18, 22, 

24, 164, 172 
CALL SPRITE subprogram .... 19, 22. 25. 

173. 65, 108. 109, 116. 120. 122. 125. 

142, 174, 175, 176 
CALL VCHAR subprogram . 1 9, 2 1 , 1 S9. 

58, 87. 176 
CALL VERSION subprogram , 18, 23. 190 

CALL subprogram 55. 183 

Character codes 67. 200 

Character conversion function (CHR$) 

20, 60 78 
Character definition subprogram 

(CHAR) 22, 25. 56. 58, 65. 120, 

J 22. 142. 174. 175 

Character limit 38 

Character pattern subprogram 

[CHARPAT) 18, 23,59 

Character set subprogram 

(CHARSET) 23. 60 

Character sets 200 



218 



TI Extended BASIC 



INDEX 



Circumflex 41 

Clear key 13 

Clear screen subprogram (CLEAR) . . . . 21 , 

61.49,55,58.60,61,65. 78.87.90.96. 

99, 103, 106, 108, 109, 116, 117, 120, 

122, 125, 130 132. 134. 136, 137, 142, 

145, 149, 151 153, 157. 158, 162, 174. 

1 75, 1 77. 1 78, 1 83 

CLOSE statement 62, 106. 1 1 3. 1 53 

Codebreaker program 27 

Coincidence of sprites subprogram 

(COINC) 18, 22, 25. 64. 65. 1 76 

I Colon 19, 147 

Color codes 66, 165, 198 

Color combinations 199 

Color of characters subprogram 

(COLOR) . . 19. 21. 22. 25, 66. 58. 78. 

142, 175, 176 
Color of screen subprogram 

(SCREEN) , . .19.21.25,165,84,175 

Comma 19, 147 

Command Mode 11 

Commands 16 

Commands used as statements . - 16 

t Comment, tail (!) 38 

Computer transfer See ON.,. GOSUB, 

ON. .GOTO 

Computer's limit 39 

Concatenation 41 

Constants 39 

CONTINUE command 16, 26, 52. 68 

Conversion table 57 

; Correcting errors 11 

:Cosine function (COS) 20. 69 



! DATA statement 70, 71,99. 183 

Debugging 26 

DEFine statement , 72, 122 

DELETE clause 62 

DELETE command 16. 74 

Delete key 13 

Delete sprite subprogram 

(DELSPRITE) 22. 25. 75. J 77 

DIGIT clause 47 

DIMension statement 76, 28, 48, 96 

DISPLAY USING statement ... 19. 79. 97 

DISPLAY clause 139. 113 

DISPLAY statement , . .19,77.28,29,30, 

31, 32, 48, 49, 78. 106, 125. 134 136. 

183 
Distance of sprites subprogram 

(DISTANCE) 18, 22. 25. 80 

Division 41 

Down arrow key - , . 13. 32 



E 

Edit Mode 11 

ELSE clause 94 

End of file function {EOF) 20, 82, 1 13 

END statement 81 

Enter key 13.28-32 

ERASE ALL clause 47.77 

Erase key 13 

ERROR. ON statement . . .26,83, 131,84, 
132, 158 

Error handling . . . 26, 2 1 1 

Error subprogram .18, 23, 83, 84, 132 

Error messages 211 

Exponential function (EXP) 20, 85 

Exponentiation 41 

Expressions 41 

F 

Files 38 

FIXED clause 139,106, JJ3 

FOR -TO-STEP statement , , . 18.86, 127. 
30, 32, 48, 49. 58. 60. 71 . 78, 87. 96, 99, 
106. 120. 122. 125. 127, 130. 142, 151. 
153, 157, 171, 175, 177. 183 

Forwardspace key 12 

Functions, built-in 19 20 

Functions, user written 21.201 

G 

Get character subpogram (GCHAR) ..18, 

21.88 
GOSUB statement 21 . 89, 58, 90, 

120, 122, 157 
GOTO statement 91,29,49,58.61, 

78.87.90, 91, 103, 108, 109. 113. 116. 

117, 134. 142, 145, 151. 162. 174, 175, 

176, 117. 178 

Greater than 41 

H 

hexadecimal ,57 

Hierarchy, arithmetic . .41 

Horizontal character subroutine 

(HCHAR) 19.21,92,58, J42. 175 

I 

IF-THEN-ELSE statement . . 94. 29. 30, 32. 

48, 78, 90, 91, 96. 99. 109, 113, 117. 

132, 134. 136. 145, 157, 158. 162, 176, 

178 
IMAGE statement- . . .19,97,99,100.103 
:nitialization subprogram (INIT) . .22, 101 

Input 17 

INPUT clause 139, 106,113 

INPUT statement (files) .... 104, 106, 153 
INPUT statement (kevboard) ... 17. 102. 

74.90.96. J 03. 117, 145. 151. 157. 162 



TI Extended BASIC 



219 



INDEX 



Insertkey 13 

Integer function (INT) 20, 107 

INTERNAL clause 139, J 06 

J 

Jovs tick subprogram (JO YST) . . . .18,21. 
*108 

K 

Keystroke subprogram (KEY) 18. 21 , 

'78. 109 
Keywords 40 

L 

Leaving TI Extended BASIC 54 

Left arrow kev 12 

Length function (LEN) 20, 1 10 

Less than - ■ .41 

LET statement . . . . 1 7, 1 1 1 . 30. 55, 58, 65. 
69 78. 87. 90. 91, 96. 99, 113, 116, 
117. 122, 127, 128. 132. 142, 145, 157, 
153, 168, 171, 175, 176. 178, 183. 186 

Limits, computer 39 

Line numbering, automatic (NUMBER) 

38 

Line numbers 38 

Lines .38 

Link subprogram (LINK) 22. 112 

LINPUT statement \7.113 

LIST command 16. 114 

Load subprogram (LOAD) 22. 115 

Locate sprite subprogram (LOG ATE) . . 18, 
22 25. 116, 176, 177 

Logarithmic function (LOG) 20. 1 1 7 

Logical operators 42 

Loop 86 

M 

Magnify sprites subprogram 

(MAGNIFY) 22', 15, 118, 120, 142, 

173 

Mantissa . 39 

Master selection list 11 

Master title screen 11 

Maximum function (MAXl 20, 121 

MERGE clause 163 

MERGE command 16, 122 

Minimum function (MIN) 20, 124 

Modes - 11 

Motion of sprites subprogram 

(MOTION) 22. 25, 125. 108, 109. 

122. 125. 176. 177 

Multiple statement separator (::] 38 

Multiplication 41 

Musical tone frequencies 196 



N 

Name (variable) 39-40 

NEW command 16, 126 

NEXT statement . . 18. 86, 127, 30, 31. 32. 
49. 58. 60, 71. 78. 87, 96 99, 106, 120, 
122, 125. 127, 130. 142. 151. 153. 157 
171, 175, 177,183 

Noise 170 

Normal decimal form 39 

NOT logical operator . . . 42 

Notational conventions 39 

NUMBER command .13, 128, 28. 29. 3 1 

Numberrepresentation 39 

Number-string function (VAL) 186 

Numbers 39 

NUMERIC clause 47 

Numeric constants 39 

Numeric exprcssiens 41 

Numeric variables 41 

O 

OLD command 16, 129 

ON.., GOSUB statement ... .21. 133, J 34 
ON.. .GOTO statement .... 135, 136,183 

ON BREAK statement 26. 52, J 30 

ON ERROR statement 26.83. 131. 

84, 132, 158 

ON WARNING statement 26, J 37 

OPEN statement 1 38, 1 06, 1 J 3. 1 53 

Operators (Arithmetic, Relational. 

String, Logical) 41-44 

OPTIONBASE statement 141 

OR logical operator 42, 183 

Order of ope rat ions 41 

Output 18 

OUTPUT clause 139 

Overflow 39 

P 

Parameter 19, 72, 180 

Parentheses - . ■ -41 

Pattern of sprites subprogram 

(PATTERN) 22. 25, 142, 1 76, 1 77 

Pattern-identifier conversion, table . . . .57. 

197 

Peck subprogram (PEEK) 22, 143 

Pendinginputs 105 

Pending outputs 148 

Pi, value of function (PI) 20. 144, 69. 

168, 186 
Position in a string function [POS) . . . .20. 

145 
Position of sprites subprogram 

(POSITION) 22. 25. 146. 176, 177 

Powers 41 



IINDEX 



220 



TI Extended [3 ASK: 



rpRINT statement . . 19. 147, 55, 60, 61 , 65. 

69, 71, 84. 90, 91. 96, 99. 103, 106. 

113,117, 127,128, 130,132. 137.145. 

149,151. 153,157. 158, J 62, 168.178, 

183, 186 

[print separators 19. 147 

[PRINT USING statement 19, 96, 150. 99, 

100, 103 

'rogram lines 38 

iOTECTED clause 163 

mdo-random numbers 151. 159 

lit kev 14. 54 

lotation marks 39 

indom number lunetion (RND) . .20, 159 

indom numbers 151, 159 

LNDOVtlZE statement .... 151. 28, J 22, 
J51, 175 
IAD statement . . 17. 70, 152, 7J , 99 J 83 

P ; REC clause _ 104 147 

['Record position function (REC) , . . 20. 1 53, 
153 

-do key 13. 28. 30. 31 . 32 

National expressions 41 

NATIVE clause 138 1 53 

DMarkstatemen: . . 154. 28, 90, 91 .120. 
132,158. 176,177 

;marks. tail{!) 38 

smote controls 108 

;peat string function (RPT$) .20. 160 

teserved words ..40 

ssct 54 

^SEQUENCE command 16, 155 

CSTORE statement . . . 70. 156, 153. 183 
pfcETUKN statement . . 26. 157, 158. 58, 90, 
120, 122 t 132. 134, 136 

tight arrow key 12 

tUN command 16.161,162,183 

tun Mode 11 

lunning a TI Extended BASIC 

program 38 

SAVE command 16, 163 

*y subprogram (SAY) 19. 22. 24, 

164, 202 

:ientlfic notation 39, 97 

ireen color subprogram (SCREEN) .19, 

21. 25. 165, 84, 175 
*gmen: of a string function (SEGS) . . . 20, 

166 

;micolon 19. 147.185 

sparator Symbol;::) 38 



i Extended BASIC 



SEQUENTIAL clause 138. J 06 

Sign of a number function (SON) . .20. 167 

Sine function (SIN) 20, 1&8 

SIZE clause 47.77 

SIZE command 17, 169 

Sound generation subprogram 

(SOUND) 19.22.24. 

170, 1 71 

Spaces ,...,,. 39 

Special function keys 12-14 

Speech 202 

Speech pattern gettiig subprogram 

(SPGET) 18. 22. 24, 172, 202, 

164, 172 

Split console keyboard 200 

Sprite definition subprogram 

(SPRITE) IS. 22. 25. 173, 65, 108, 

109. 116, 120. 122, 125. 142. 174. 175. 
176 

Sprites 22, 25 

Square roof function ;SQR) 20. 178 

Statement Separator Sym bol (: ) 38 

Statements 16, 17-26 

STOP statement 1 78, 31 . 55. 84. 90. 

113, 120. 122. 132. 157, 158, 162. 118 

String constants 39 

String expressions 41 

String functions 39 

String variables 40 

String- nu in ber function! ST R8). . 20, 179 
String-segment function (SEGS] . . 20. 166 

Strings 39.41 

SUB statement 180, 55. 183 

SUBEND statement 184. 55. 183 

SUBEXITsLaiemcm 184. 1 63 

Subprograms, user written 23-24, 55 

Subprograms, built-in 8,21,55 

Subroutines, user written 21 

Subscript 76 

Subtraction , . , 41 

Suffixes . . 205 

T 

Tabular function (TAB) 20. 185, J 03 

Tail comment symbol (!) 38 

Tangent function (TAN) 20, 186 

THEN clause 94 

Tories 1 70 

TRACE command 16. 26. 186 

Trigonometric functions (AT N. COS, 

SIN. TAN) 51.69, 168. 186 



221 



INDEX 



u 

UALPffA clause 47 

UNBREAK command 16, 26. 52. 187 

UNTRACE command 16. 26, 187 

Uparrow key 12 

UPDATE clause 139 

User-defined functions 21 

V 

VALIDATE clause 47 

Value function (VAL) 20, 188 

Variables 39 

VARIABLE clause 139 

Version of BASIC subprogram 

(VERSION) 18.23. 190 

Vertical character subprogram 

(VCHAR) 19. 21, 189. 58. 1 76 

W 

WARNING, ON statement 26. 13? 

Wired Remole Controllers 108 

X 

XOR logical operator 42 



222 



TI Extended BASIC fl Extended BASfC 



223 



SERVICE AND WARRANTY 
INFORMATION 



THREE MDNTH LIMITED WARRANTY 



IN CASE OF DIFFICULTY 

If TFExtended BASIC does not appear to be working properly, check the 
following: 

1. Power — Be sure all devices are plugged in. Then turn on ihe power to 
the units in the proper sequence: Peripheral devices first (if you have 
them), followed by the console and monitor. Insert the TI Extended BASIC 
module carefully, 

2. Connector Separation — Check for proper alignment of the console and 
any accessory devices such as the Disk Drive Controller. Speech 
Synthesizer, and RS232 Interface. Remove and reinsert the TI Extended 
BASIC module. 

3. If none of the above procedures corrects the difficulty, consult "If You 
Have Questions or Need Assistance 1 ' or see the "Service Information" 
portion of the User's Reference Guide that came with your computer. 

If you have questions concerning module repair or peripheral, accessory, or 
software purchase please call our Consumer Relations Department at (800) 
858-4565 (toll free within the contiguous United States except Texas) nr (800} 
692-4279 within Texas. The operators at these numbers cannot provide 
technical assistance. 

For technical questions about programming, specific applications, etc., you 
can call (806) 741-2663. Please note that this is not a toll-free number and 
collect calls cannot be accepted. 

As an alternative, you can write to: 
Consumer Relations Department 
Texas Instruments Incorporated 
P.O. Box 53 
Lubbock, Texas 79408 

Because of the number of suggestions winch come to Texas Instruments 
from many sources containing both new and old ideas, Texas instruments 
will consider such suggestions only if they are freely given to Texas 
Instruments. It is the policy of Texas Instruments to refuse to receive any 
suggestions in confidence. Therefore, if you wish to share your suggestions 

language program which you have developed, please include tae following 

statement in your letter: 

'"All of the information forwarded herewith is presented to Texas 
Instruments on a nonconfidential, nonobligatory basis; no relationship, 
confidential or otherwise, expressed or implied, is established with 
Texas Instruments by this presentation. Texas Instruments may use, 
copyright, distribute, publish, reproduce, or dispose of the information 
in any way without compensation to me," 



THIS TEXAS INSTRUMENTS TI EXTENDED BASIC COMMAND MODULE 

WARRANTY EXTENDS TO THE ORIGINAL CONSUMER PURCHASER OF THE 

MODULE. 

WARRANTY DURATION: This command module is warranted to the 

original consumer purchaser for a period of three months from the original 

purchase date. 

WARRANTY COVERAGE: This command module is warranted against 

defective materials or workmanship. THIS WARRANTY IS VOID W THE 

COMMAND MODULE HAS BEEN DAMAGED BY ACCIDENT, UNREASONABLE 

USE, NEGLECT, IMPROPER SERVICE OR OTHER CAUSE NOT ARISING OUT 

OF DEFECTS IN MATERIAL OR WORKMANSHIP. 

WARRANTY DISCLAIMERS: ANY IMPLIED WARRANTIES ARISING OUT OF 
THIS SALE, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
Or MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE 
LIMITED IH DURATION TO THE ABOVE THREE MONTH PERIOD. TEXAS 
INSTRUMENTS SHALL NOT BE LIABLE FOR LOSS OF USE OF THE MODULE 
OR OTHER INCIDENTAL OR CONSEQUENTIAL COSTS, EXPENSES, OR 
DAMAGES INCURRED BY THE CONSUMER OR ANY OTHER USER. Some states 
do not allow the exclusion or limitation of implied war-anties or consequential 
damages, so the above limitations or exclusions may not apply to you. 
LEGAL REMEDIES: This warranty gives you specific legal rights, and you 
may also have other rights that vary from state to stats. 
WARRANTY PERFORMANCE: Please first contact the retailer from whom 
you purchased the module and determine the exchange policies of the retailer. 
During the above three month warranty period your TI Extended BASIC 
command module will be repaired or replaced with a new or reconditioned 
unit of the same or equivalent model (at TI's option) when the module is 
returned by prepaid shipment to a Texas Instruments Service Facility listed 
below. The repaired or replacement unit will be warranted for three months 
from the date of repair or replacement. Other than the postage requirement, 
no charge will be made for the repair or replacement of in-warranty modules. 
Texas Instruments strongly recommends that you insure the module for 
value prior to shipment. 
Texas Instruments Consumer Service Facilities 



[j. S. Residents: 

Texas Instruments Service Facility 
2303 North University 
Lubbock. Texas 79415 



Canadian customers only: 

Geophysical Servkes Incorporated 

41 She. Icy Road 

Richmond Hill. Ortario. Canada L4C5G4 



Consumers in California and Oregon may contact the following Texas 
Instruments office for additional assistance or information. 

Texas Instruments Consumer Service Texas Instrument? Cons timer Service 

831 South Douglas Si reet 6700 Southwest 105th 

El Segundo. Cuhtnrnia 90245 Kristin Square, Suite 1 10 

(213)973-1803 Btaverton, Oregon 97005 

(503)643-6758 



224 



TI Extended BASIC 



TI Extended BASIC 



ADDENDUM 

11 Extended BASIC Owner's Manual 



The program listing on page 153 in the manual is incorrect. Line 110 

should read: 

>H0 OPEN #1:"DSK1.RNDFILE", RELATIVE, INTERNAL 



Copyright £■ 1983 Texas Instruments Incorporated 1053596-2 

Printed in U.S.A. (Use with 1041345-1) 



IMPORTANT PRODUCT INFORMATION 
FOR TI EXTENDED BASIC 



TI Extended BASIC has been enhanced and modified for use with 
both the TI-99/4A and Tl-99/4 Computers. SeveraJ important product 
differences should be noted in relation to the type of computer you 
have. Please read this folder and mark the appropriate changes in 
your copy of the TI ExtendrU BASIC owners manual. 

Although the TI-99/4A and TI-99/4 Computers are similar, the 
TI-99/4A is easily recognizable by its standard typewriter keyboard 
which returns both upper case (large capital) and lower-case (small 
capital) alphabetical characters. Depressing the ALPHA LOCK key 
locks the alphabet keys in upper-case mode. To release ALPHA LOCK, 
press the key again. 

When the TI Extended BASIC module is in place, both the TI-99/4A 
and TI-99/4 Computers share several enhancements. However, each 
computer also has its own unique features. These features are 
discussed in the following paragraphs. 

AUTO REPEAT FEATURE 

When using TI Extended BASIC on either computer, holding down a 
key for more than one second automatically causes its symbol to be 
repeated on the display until you release the key. 



SPECIAL FUNCTION KEYS 

The TI-99/4A Computer has the same special computer functions as 
the T I -99/4. However, Lhese funeLiuns tue frequently assigned to 
different keys on the T I -99/4 A Computer. The following chart 
compares the keystroke sequences for the function keys on the two 
units. 





Function Keys 




Key 


77-99/4 


TIB9/4A 


Name 


Keys 


Keys 


AID 


SHIFT A 


FCTN7 


CLEAR 


SHIFT C 


FCTN4 


DEUte 


SHIFT F 


FCTN 1 


INSert 


SHIFT G 


FCTN2 


QUIT 


SHIFT Q 


FCTN = 


REDO 


SHIFT R 


FCTN 8 


ERASE 


SHIFT T 


FCTN 3 


LEFT arrow 


SHIFT S 


FCTNS 


RIGHT arrow 


SHIFT D 


FCTN D 


DOWN arrow 


SHIFT X 


FCTNX 


UP arrow 


SHIFT E 


FCTN E 


PROC'D 


SHIFT V 


FCTN 6 


BEGIN 


SHIFT W 


FCTNS 


BACK 


SHIFT Z 


FCTN 9 


ENTER 


ENTER 


ENTER 



In addition to these functions, the TI-99/4A Computer has functions 
represented as symbols on the fronts of the individual keyfaces. 
These functions may be accessed by pressing FCTN and the 
appropriate key simultaneously. 

CONTROL KEYS 

The TI-99/4A Computer also has control characters which are used 
primarily for telecommunications. To enter a control character, hold 
down the CTRL key and press the appropriate letter, number, or 
symbol key. 



EXPANDED CHARACTER SET — TI-99/4A 

As explained in your TI Extended BASIC manual, codes 32-95 are 
the predefined standard ASCII characters on the TI-99/4 Computer. 
The cursor and edge characters, ASCII codes 30 and 31, are assigned 
to character set 0. The undefined character codes (128-135 and 
136-143) are assigned to sets 13 and 14, respectively. 

These codes and the corresponding characters are listed in Appendix 
C of the manual. The CALL KEY character codes are also listed in 
Appendix C. Appendix £ in the manual lists the 15 character code 
sets which may be used for color graphics. 

Due to the inclusion of the lower-case character set, the defined 

characters on the T 1-99/4 A Computer are the standard ASCII 
characters for codes 32 through 127, The following chart lists these 
characters and their codes. 



ASCII 




ASCII 




CODE 


CHARACTER 


CODE 


CHARACTER 


30 


■ (cursor) 


55 


1 


31 


(edge character) 


56 


8 


32 


(space) 


57 


9 


33 


! (exclamation point) 


58 


: (colon) 


34 


" Iquote) 


59 


; (semicolon) 


35 


# (number or pound sign) 


60 


< (less than) 


36 


$ (dollar) 


61 


= (equals) 


37 


% (percent) 


62 


> (greater than) 


38 


& (ampersand) 


63 


? (question mark) 


39 


' (apostrophe) 


64 


@ (at sign) 


40 


( (open parenthesis) 


65 


A 


41 


) (close parenthesis) 


66 


B 


42 


* (asterisk) 


67 


C 


43 


+ (plus) 


68 


D 


44 


. (comma) 


69 


E 


45 


- (minus) 


70 


F 


46 


. (period) 


71 


G 


47 


/ (slant) 


72 


H 


48 





73 


I 


49 


1 


74 


J 


50 


2 


75 


K 


51 


3 


76 


L 


52 


4 


77 


M 


53 


5 


78 


N 


54 


6 


79 


O 



ASCII 




ASCII 






CODE 


CHARACTER 


CODE 


CHARACTER 


80 


P 


104 


h 


i 




81 


9 


105 


i 




82 


R 


106 


J 






83 


S 


107 


k 






84 


T 


106 


1 






85 


U 


109 


m 






86 


V 


110 


n 






87 


W 


1 l 1 


n 




Displayed 


88 


X 


1 12 


P 




on screen 


89 


Y 


113 


q 




as small 


90 


Z 


114 


r 




capitals. 


91 


[ (open bracket) 


115 


s 






92 


\ (reverse slant) 


116 


t 






93 


J (close bracket) 


117 


u 






94 


A(exponentiation) 


118 


V 






95 


_ (line) 


119 


w 






96 


s (grave) 


120 


X 






97 


a -* 


121 


y 






98 


b 




122 


z 


> 




99 


c 


Displayed 


123 


{ 


(left brace) 


10O 


j i on screen 


124 


1 

1 


(vertical line] 


101 


e 


as small 


125 


) 


(right brace) 


102 


f 


capitals. 


126 


~ 


(tilde) 


103 


g > 




127 


DEL (appears on 








screen as a 










blank) 



CALL KEY SUBPROGRAM 

The information given on the KEY subprogram in Chapter 4 of the Tl 
Extended BASIC manual is accurate for the TI-99M Computer. The 
values of 3, 4, and 5 are not accessible as key units. 

However, the TL99/4A maps key units through 5 to specific modes 
of operation. If the key-unit is 0. the keyboard is mapped in 
whichever mode was specified by the previous CALL KEY program 
line. 

If the key-unit is 1, input ia taken from the left side of the keyboard. 

If the key-unit is 2, input is taken from the right side of the 

keyboard. 

A key-unit of 3 maps the computer into the standard 1 1-99/4 

keyboard mode. Both upper- and lower-case characters are returned 

as upper-case characters only. Function codes 1 through 15 are 

active, but no control characters are returned. 



A key-unit of 4 places the computer in Pascal mode with both upper- 
and lowercase characters active. The function codes 129 through 
143 and the control character codes 1 through 31 are also active. 

The key-unit 5 maps the TI-99/4A Computer in the BASIC mode. 
Both upper- and lower-case characters arc active. The active function 
codes are 1 through 15. and the active control character codes are 
128 through 159 (and 187). 

In addition, codes are assigned to the function and control keys so 
that these can be referenced by the CALL KEY subprogram in TI 
Extended BASIC. The codes assigned depend on the key-unit value 

specified in a CALL KEY program statement. The following tables 

show typical code assignments. 



FUNCTION KEY CODES 



Codes 



TI-99/4 & 


Pascal 


Function 


Function 


BASIC Modes 


Mode 


Name 


Key 


1 


129 


AID 


FCTN7 


2 


130 


CLEAR 


FCTN4 


3 


131 


DELete 


FCTN1 


4 


132 


INSert 


FCTN 2 


5 


133 


QUIT 


FCTN * 


6 


134 


REDO 


FCTN8 


7 


135 


ERASE 


FCTN 3 


8 


136 


LEFT arrow 


FCTNS 


9 


137 


RIGHT arrow 


FCTND 


10 


138 


DOWN arrow 


FCTNX 


11 


139 


UP arrow 


FCTNE 


12 


140 


PROC'D 


FCTN 6 


13 


141 


ENTER 


ENTER 


14 


142 


BEGIN 


FCTNS 


15 


143 


BACK 


FCTN 9 



CONTROL KEY CODES 



Codes 



BASIC 


Pascal 


Mnemonic 






Mode 


Mode 


Code 


Press 


Comments 


129 


1 


SOH 


CONTROL A 


Start of heading 


130 


2 


STX 


CONTROL B 


Start or texi 


131 


3 


ETX 


CONTROL C 


End of text 


132 


4 


EOT 


CONTROL D 


End of transmission 


133 


5 


ENQ 


CONTROL E 


Enquiry 


134 


6 


ACK 


CONTROL F 


Acknowledge 


135 


7 


BEL 


CONTROL G 


Bell 


136 


8 


BS 


CONTROL H 


backspace 


137 


9 


HT 


CONTROL 1 


Horizontal tabulation 


138 


10 


LF 


CONTROL J 


Line feed 


139 


11 


VT 


CONTROL K 


Vertical tabulation 


140 


12 


FF 


CONTROL L 


Form feed 


141 


13 


CR 


CONTROL M 


Carriage return 


142 


14 


SO 


CONTROL N 


Shift out 


143 


15 


SI 


CONTROL 


Shift in 


144 


16 


DLE 


CONTROL P 


Data link escape 


145 


17 


DC1 


CONTROL U 


Device control l (XON) 


146 


18 


DC2 


CONTROL R 


Device control 2 


147 


19 


DC3 


CONTROL S 


Device control 3 {X-OFF) 


148 


20 


DC4 


CONTROL T 


Device contiul 4 


149 


21 


NAK 


CONTROL U 


Negative acknowledge 


150 


22 


SYN 


CONTROL V 


Synchronous idle 


151 


23 


ETtJ 


CONTROL W 


End of transmission bloc 


152 


24 


CAN 


CONTROL X 


Cancel 


153 


25 


EM 


CONTROL Y 


End of medium 


154 


26 


SUB 


CONTROL Z 


Substitute 


155 


27 


ESC 


CONTROL . 


Escape 


156 


28 


FS 


CONTROL ; 


File separator 


157 


29 


US 


CONTHOL = 


Group supinator 


158 


30 


RS 


CONTROL 8 


Record separator 


159 


31 


US 


CONTROL 9 


Unit separator 



You may also obtain detailed CALL KEY subprogram information, 
including keyboard diagrams, in your User's Reference Guide for the 
TI-99/4A Computer. 

CALL VERSION SUBPROGRAM 

The VFKSTON subprogram (discussed in Chapter 4 of your 77 
Extended BASIC manual) now returns a value of 1 10 on both 
computers. (5 



DATA STATEMENT 

The computer reads any information entered after a DATA statement 
as a part of the DATA statement. Therefore, in a muUi-slalcment 
program line, a DATA statement should not be followed by another 
statement. 

SCIENTIFIC NOTATION 

Whenever you use scientific (or exponential) notation, be certain that 
the "E" is an upper-case (large capital) character. A lower-case "e" 
may cause your program to function improperly. 

PRE-SCAN — !@P- and !@P + 

After you enter RUN to start a program, you may notice a pause 
before the program actually begins. This pause is the time the 
computer takes to "pre-scan" ynnr program to establish memory 
space for variables, arrays, and data. Then the computer proceeds 
through each instruction, performs the appropriate functions, and 
establishes variable values. Since (he time required to pre-scan 
depends on the length of the program, you may want to decrease the 
pre-scan pause, particularly if you have a long program. 

TI Extended BASIC s new pre-scan commands, !@P- mid !@P+ , 
allow you to control which instructions will not be pre-scanned. 
Because the purpose of the pre-scan is to set memory space for 
variables, only those instructions whteh eon tain the first reference to 
the variables need to be pre-scanned. Therefore, many other 
instructions in your program do not require a pre-scan. 
Careful program planning is required to minimize the statements 
that need the pre-scan. When certain types of statements (as 
explained here) are used in your program, the procedures listed 
below should be included in the pre-scan. 

■ Enter your^irsf DATA statement within the pre-scan. 

■ Include the fir3t use of each variable and/or array. (Also, 
include the OPTION BASE statement, if used.) 

■ Include the first reference to each CALL statement of any 
subprogram. 

■ Include all DEF statements for user-defined functions. 

■ Include all SUB statements and SUBEND statements in the 
pre-scan. 



Note that a variable in a user-defined (SUB) subprogram is 
considered to be unique from any other variable used elsewhere in 
your program, even though the name and value may be the same. 
Therefore, each variable used in a user-defined subprogram must be 
included in the pre -scan. 

To use the pre-scan option, first be certain that your completed 
program runs successfully. Then, at the beginning of a group of 
function statements, use the !@P- command to "turn off" the pre- 
scan. The following statements will not be pre-scanned. allowing the 
execution of your program to begin more quickly. Any statements 
related to variable names (not previously referenced during pre-scan) 
return a syntax error if the pre-scan is "off" Note that !@P- cannot 
be followed by another statement in a multiple statement. 

To resume the pre-scan. simply enter the command !@P + . This 
command causes the pre-scan to "turn on" and memory space for 
variables may be set. Remember to use the !@P + command before a 
SUB or SUBEND statement and do not incorporate this command as 
a part of a multiple statement. 

You may choose to use the pre-scan feature several times throughout 
your program. By turning the pre-scan on and off. your program can 
begin to execute more efficiently. The effectiveness of the pre-scan is 
more noticeable in large programs than small programs. Note that 
when using the TI-99/4A Computer, the commands, !@P- and 
!@P+ , may also be entered with a lower-case "p" character. 

The following examples illustrate how to include the pre-scan 
statements in an existing program. The final example demonstrates 
the most efficient use of the pre-scan feature by making use of a 
GOTO statement. 



Examples; 

Original program: 

100 CALL CLEAR 

110 CALL CHaR{96/'FFFFFFFFFFFFFFFF") 

120 CALL CHAR(42,"0FOF0FOF0F0FOFOF") 

130 • 

140 . 

150 . 

lbU CALL HCHAK(12,17,42) 

170 CALL VCHAR(l4, 17,96) 

180 DELAY=Q 

190 FOR DELAY- 1 TO 500 
200 NEXT DELAY 
210 DATA 3 
220 . 
230 . 

With pre-scan control added: 

10 DATA 3 

100 CALL CLEAR 

110 CALL CHAR(96/'FFFFFFFFFFFFFFFF") 

120 CALL CHAR(42,"0F0FOFOF0F0FOFOF") 

125 !$P- 

130 . 

140 . 

150 . 

155 !0P+ 

160 CALL HCHAR( 12, 17,42) 

170 CALL VCHAR( 14, 17,96) 

180 DELAY =0 

185 IgP- 

190 FOR DELAY=1 TO 500 

200 NEXT DELAY 

210 . 

220 . 

230 . 

Notice that the first DATA statement has been moved to the 

beginning of the program so that it is included in the pre-scan. By 

including statements 125, 155, and 185, the pre-scan is turned off 
and on and off again. This causes the program to begin to execute 
more quickly. 



With GOTO added: 

You have the added ability to "trick" the computer into establishing 
memory space for CALL statements, as well as variable-related 
statements, without actually performing those statements. To do 
this, simply use a GOTO instruction in your program. The following 
example demonstrates the original program adapted with a pre-scan 
and a GOTO statement. 

10 DATA 3 

20 GOTO 100:: DELAY:: CALL CHAR::CALL CLEAR;: CALL HCHAR::CALL 

VCHAR::!gP- 
100 CALL CLEAR 

110 CALL CHAR(96, "FFFFFFFFFFFFFFFF") 
120 CALL CHAR(42,"0F0FOF0FOF0FOFOF") 
130 . 
140 . 
150 . 

160 CALL HCHAR( 12, 17,42) 
170 CALL VCHAR( 14 ,17,96) 
190 FOR DELAY=1 TO 500 
200 NEXT DELAY 
210 . 
220 . 
230 . 

Note that the GOTO method causes the necessary memory space to 
be reserved in line 20. However, the statements in line 20 do not 
execute until they are encountered further on in the program. Thus, 
as shown in the preceding and following examples, you can put all of 
your variable references together and your subprogram calls do not 
have to be syntactically correct. This can be the most efficient use of 
the pre -scan option. 

100 GOTO 180 ::X,Y, ALPHA, BETA, Z=DELTA;: DIM B(l0,10) 

110 CALL KEY::CALL HCHAR::CALL CLEAR: :CALL MYSUB 

120 DATA 1,3, STRING 

130 DEF F(X)=1-X*SIN(X) 

140 . 

150 . 

160 . 

170 !@P- 

180 . 

190 . 

200 . 



10 



PROGRAMMING WITH LOWER-CASE LETTERS 

Device names must be entered in uppercase (large capital) letters 
only. For example, DSK1" is a correct deviue name, but "Dskl" is 
not. Any reference to a device name spelled in lower-case (small 
capital) letters results in an error message. 

File names are also very specific. Not only are they exact as to the 
correct spelling, but they are also specific as to the use of upper- or 
lower-case letters. For example, the file name, MYFILE, is not the 
same file as Myfile (a combination of large and small capital letters). 
Any file name listed in part or whole by lower-case letters Is not 
accessible by the TI-99/4 Computer. Only the TI-99/4A Computer can 
access a program named or called in lower-case letters. 

Lower-case letters in DATA statements or quoted strings function 
correctly and offer a wide variety of programming techniques on the 
TI-99/4A Computer. However, lower-case quoted strings and data are 
not displayed if you run the program on a TI-99/4 Computer. If you 
plan to run ynnr program on both the TI-99/4 A and TI-99/4 
Computers, take special care when using lower-case letters. 

To display the lower-case letters in your TI-99/4A Computer program 
when Qic piugiiun is iun on a TI-99/4 Computer, simply include the 
following statements. Small capital letters are created similar to those 
of the TI-99/4 A. Be sure to allow adequate memory space and 
execution Ume. 

100 FOR 1=65 TO 90 

110 CALL CHARPAT(I,A$) 

120 B$ = "OOQ0"i5EG*(A*,l,4)S(SEG*(A$,7,4)&SEG|(A»,l3,4) 

130 CALL CHAR(I+32,B$) 
U0 NEXT I 

Insertion of the above program lines into your TI-99/4 A program 
allows pre programmed lower-case characters to be displayed by the 
TI-99/4 computer. 

SIZE COMMAND 

The SIZE example, using the Memory Expansion unit discussed in 
Chapter 4 of your 77 Extended BASIC manual, now informs yuu that 
you have 24488 "BYTES OF PROGRAM SPACE FREE", 

TAIL REMARKS 

If you previously programmed a TAIL REMark that is identical to the 
pre-scan instructions (!@P + or !@P - ). your program will no longer 
function prupcily. These groups of characters arc now considered to 
be "reserved words" for the operation of the computer. 

11 



CORRECTION TO APPENDIX C 

ASCII code 12 in Appendix C of your TI Extended BASIC manual 
should be stated as the "PROC'D" character rather than as the 
"CMD" character. 

LARGE PROGRAM FILES 

Some programs written with TI BASIC may be too large to run with 
Tl Extended BASIC because TI Extended BASIC requires more 
system overhead than TI RASTO If ymi attempt to load $;ueh a 
program, your system will lock up. Before you can continue, you 
must turn your computer off, wait several seconds, and then turn it 
on again. 

Entering a CALL FILES(l) or CALL FILES(2) command before 
loading your program may free enough memory to run the program 
with TI Extended BASIC. (A full explanation of the CALL FILES 
command can be found in the Disk Memory System manual.) 

If a CALL FILES command does not free enough memory, you must 
shorten your TI BASIC program by deleting statements until the 
program fits in the memory available with TI Extended BASIC. 
However, if you have a Memory Expansion unit, you can run the 
entire program by using the following procedure: 

1 . As a safety measure, make a backup copy of your TI BASIC 
program on a cassette tape or diskette. 

2. With the Memory Expansion unit attached and turned on, load 
your program with TI BASIC. Next, delete several statements, and 
save the shortened program on cassette tape or diskette, Then try 
to load this shortened program with TI Extended BASIC. 

3. Type the deleted statements back into the proper places in your 
program. 

4. Save your program on a diskette only. You are now ready to run 
your program with TI Extended BASIC and the Memory 
Expansion unit. 

Note: Programs converted in this fashion can only be run with TI 
Extended BASIC and with the Memory Expansion unit attached and 
turned on. They are not stored in PROGRAM format. 



12 



MEMORY EXPANSION UNIT AND CASSETTE-BASED 
PROGRAMS 

The Memory Expansion unit adds 32K bytes of Random Access 
Memory (RAM) to the built-in memory of the computer. However, 
even with the Memory Expansion unit available, the largest Tl 
Extended BASIC program that can be stored on a cassette tape is 
12K bytes in size. Note that, although the length of the actual 
program is limited, utilizing the Memory Expansion unit provides 
other advantages. For example, with the unit attached and turned 
on, your program (which can be up to 12K bytes in length) is stored 
in the expansion RAM. The numeric data generated by the program 
is stored in the Memory Expansion unit and the string data is stored 
in the computer s built-in memory. Without the unit, the program 
must be shorter so that both it and the generated data can be stored 
in the computers built-in memory. 

CONTINUE COMMAND 

A CONTINUE command is used to resume your program when you 
break by using a BREAK command or by pressing CLEAR. However, 
if your last command (before the CONTINUE command) results in a 
error, the program may not continue properly. Your final command 
to the computer before the CONTINUE command must be correct. If 
you receive an ERROR message, be sure to enter a correct command, 
such as a PRINT command, before resuming program execution. 

MANUAL ERRORS 

Page 39 

The second sentence in the third paragraph of the "Numeric 
Constants 1 ' section should be corrected to read "...number is greater 
than 99 or less than -99, then ,..." 

Pages 79 and 150 

The string used in a string-expression with the DISPLAY ... USING 
and PRINT ... USING statements may be more general than shown in 
the examples in the manual. For example, both of the following are 
valid statements. 

PRINT USING A$:X,Y 

DISPLAY USING RPT$C'?r,5)OT:A(12) 

Pages 89, 133, and 133 

The GOSUB, ON GOSUB, and ON GOTO statements should not be 

used to transfer control to and from subprograms. 



13 



Page 1 1 4 

If you press CLEAR when using the LIST command, the listing stops 

and cannot be restarted. 

Pages 1 1 8 and 1 1 9 

The graphic figures at the bottom of page 118 and the top of 1 19 
should be reversed. 

Page 185 

The TAB function cannot be used in the PRINT ... USING or 
DISPLAY ... USING statements, Also, the second paragraph of this 
explanation should be corrected to read as follows: "If the number of 
characters already printed on the current record is less than 
numeric-express ton, the next print-item is printed beginning on the 
position indicated by numeric-expression. If the number of 
characters already printed on the current record is greater than or 
equal to the position indicated by numeric-expression, the next 
print-item is printed on the next record beginning in the position 
indicated by numeric-expression. 

Page 200 

In Appendix H. Color Combinations, the color codes for the last two 

listings m the "Best " category should be as follows. 

14. JO Magenta on Light Red 

3. 16 Medium Green on White 

In the "Fourth Best" category, the third combination in the second 
column should read: 

6, 2 Light Blue on Black. 



14 



Format Lines 

The following list gives corrections that should be made to the 
indicated formats and also shows the present format information. 

DIM Statement (page 76] 

Correct Format. (integerl\,integer2}...[,integ€r7]}[,.. .] 

Present Format: {integer Iltnteger2]...[.tnteger7}\,...\) 

DISPLAY Statement (page 77) 

Correct Format: [SIZE [numeric-expression)}:]prmt-list 
Present Format: [SIZE (numeric expression)] :}uariable-list 

DISPLAY ... USING Statement (page 79) 

Correct Formats: USING string-expression[:print4ist} 

USING Une~nwnber\:prLnUist] 
Present Formats: USING string-<cxprcssion\\v<Ari<ibl<?-list\ 

USING line-number\:variable-list} 

LINPUT Statement (page 113) 

Correct Format: *^Ite-number[,REC record-number]'. 
Present Format: [(^He-number] [,REC record-number}.} 

PRINT USING Statement (pagp ISO) 

Correct Format: (*[/He-number[,REC record-number},} 
Present Format: [#fUe-number[, REC record number}] 

SPRITE Subprogram (page 173) 

Correct Format: dor-column[,roLy-ueiocity,commn-ue(ocfty) [.,..)) 
Present Format: dot-column, [,row-velocity ,column-velocity][.. ..]) 



15